May 27, 2021

SharePoint 2019 FBA Setup - "fullName" Error

Introduction

Recently we have set up Form based authentication (FBA) in SharePoint 2019 environment for a washing company based at Milan, Italy. We have configured the FBA with best practice but when we try to login using windows user or FBA user,  we were getting error – “Fullname”.

Issue

We faced below error when we try to login using windows user or FBA user:


Solution:

We have checked multiple blogs in google and verified that the set up was done using best practice. So, our doubt goes to configuration in web application, and we found out that “Client Integration” settings is responsible for this.

To disable the “Client Integration” settings follow below steps:

  • Go to Central Admin.
  • Click “Manage web application” under “Application Management”.



  • Select your web application.


  • Click on “Authentication provider” from Ribbon.


  • It will show default Zone. Click on that.


  • Scroll bottom of the authentication provider settings dialog.
  • Click “No” for “Client Integration” Settings.


  • Click Save.
  • It will take some time and provide below dialog. Click close.


  • Now try to login in web application. You will see the user is able to login successfully.

If you have any questions you can reach out our SharePoint Consulting team here.

May 20, 2021

How to send email without username and password using SMTP in C# in Office 365

Introduction:

We implemented a Console Application (C#) for a Real Estate Agency based out of Bellevue, Washington, United States. It was a part of the requirement to send an email from the Console Application using SMTP. Generally, we need the password of from email account when we send mail using SMTP, but in our case, we have to use an email account that has Okta MFA enabled.So, if we use the password for authentication, it won't work. As an alternate, we implemented the solution to send an email from C# Console Application (via SMTP) using App Only Authentication (with Azure App Registration).

Implementation:

First, we need to setup Azure App:

Setup Azure App:

Step 1: Go to https://portal.azure.com/.

Step 2: Now click on Azure Active Directory.  


Step 3: Now Click on "App Registration" from the left panel.


Step 4: Now Click on "New registration".


Step 5: Type the name of the app (a meaningful name) and click on the "Register" button.



Step 6: Now click on "App Permission" in left panel and add below API permissions:

  1. API Permission  > Microsoft Graph > Delegated Permission > User.Read
  2. API Permission > Add a permission > APIs in my organization uses > Office 365 Exchange Online > Application Permission > Other permission > full_access_as_app


Step 7: To use this permission of app, we need to get admin consent by Office 365 Global Admin user.


Step 8: Now go to "Certificates and secrets", and create a new client secret. Once this secret key created, note this secret key.


Step 9: Now click on "Overview" in the left panel to find Application (client) ID and Directory (tenant) ID.



C# Code

Step 1: Now go to your visual studio solution and add nuget package for EASendMail.


Step 2: Add below namespace in code.

 using System;  
 using EASendMail;  


Step 3: Now, use the below code to send mail:

 try  
 {  
     string client_id = "*****-****-****-****-*******";  
     string client_secret = "**************";     
     string tenant_id = "********-****-****-****-*******";   
     string requestData = string.Format("client_id={0}&client_secret={1}&scope=https://outlook.office365.com/.default&grant_type=client_credentials",  
     client_id, client_secret);  
     string tokenUri = string.Format("https://login.microsoftonline.com/{0}/oauth2/v2.0/token", tenant_id);  
     string responseText = _postString(tokenUri, requestData);  
     OAuthResponseParser parser = new OAuthResponseParser();  
     parser.Load(responseText);  
     string officeUser = fromEmailAddress;  
     var server = new SmtpServer("outlook.office365.com");  
     server.Protocol = ServerProtocol.ExchangeEWS;  
     server.User = officeUser;  
     server.Password = parser.AccessToken;  
     server.AuthType = SmtpAuthType.XOAUTH2;  
     server.ConnectType = SmtpConnectType.ConnectSSLAuto;  
     var mail = new SmtpMail("TryIt");  
     mail.From = officeUser;  
     mail.To = toEmailAddress;  
     mail.Subject = "Office 365 background service oauth test";  
     mail.HtmlBody = "<h3>Hello</h3><p>Do not reply to this mail.</p>";  
     var smtp = new SmtpClient();  
     smtp.SendMail(server, mail);   
     Console.WriteLine("Message delivered!");  
}  
catch (Exception ex)  
{  
     Console.WriteLine(ex.ToString());  
}  


Step 4: In above code, you can see we have not used the password of the user which is selected as mail from.

Conclusion:

This is how we can send email from C# Console Application without using the password of from email address. Hope this helps!

If you have any questions you can reach out our SharePoint Consulting team here.

May 13, 2021

[Resolved] - "[webpack] 'dist': web-part.js from UglifyJs Unexpected token: name" while building the SPFx package

Introduction

We implemented a Training Management System in SharePoint Online using SharePoint Framework (SPFx) for a Postal and Parcel company based out of Melbourne, Victoria, Australia. We were using all the latest npm packages in the web part and the web part was also working in an expected manner while testing in the workbench. But when we started building the package, it started throwing the error regarding UglifyJs for compiling ES6 code.

So, In this blog, we will learn how to resolve this error and what packages we can install so that it can compile ES6 code.

Issue

When we started with the deployment process and while running the "gulp bundle --ship" command, it throws an error message as "[webpack] 'dist': web-part.js from UglifyJs Unexpected token: name". The reason was the web part was using ES6 code for managing the array objects and UglifyJs was unable to compile the ES6 code.

Resolution

We will be using the below two npm packages as followed.

1. terser-webpack-plugin

This npm package uses "terser" which is itself a JavaScript parser and a compressor toolkit for ES6+. So, by using this package and adding its required dependencies in our solution, it will remove the UglifyJs plugin from the build chain and will also compile the ES6 code which will help us in building our package successfully.

2. webpack-merge

This npm package basically merges the array objects by converting them into a function, then performs its process, and returns the function again, this will help in compiling the ES6 code and helps us in building our package successfully.

Now, let us start with the steps to be followed.

Step 1: In the package.json file, add inside the "devDependencies" section, add the below two packages.
 "terser-webpack-plugin-legacy""1.2.3",
    "webpack-merge""4.2.1"

Step 2: In the gulpfile.js, add the below two import lines.
const merge = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin-legacy');

Step 3: Now, we need to add the below code in the gulpfile.js just before the line "build.initialize(gulp)". This is the custom configuration code that will help in the process of compiling.
build.configureWebpack.setConfig({
  additionalConfiguration: function (config) {
    let newConfig = config;
    config.plugins.forEach((plugini=> {
      if (plugin.options && plugin.options.mangle) {
        config.plugins.splice(i1);
        newConfig = merge(config, {
          plugins: [
            new TerserPlugin()
          ]
        });
      }
    });

    return newConfig;
  }
});

Step 4: Finally run the command "npm i" and this will install both the packages which we have added in the package.json file.

Conclusion:

Now, we are all set to build our package by running the command "gulp bundle --ship" and our issue will be resolved. Happy Coding!!

If you have any questions you can reach out our SharePoint Consulting team here.

May 6, 2021

Power of AI with Project Cortex and SharePoint Syntex

Overview:

When we hear the word “Project Cortex” for the first time, we have a question, what do we mean by Project Cortex?, What we can achieve with the Project Cortex? We are living in an era where AI has become the most important part of our daily routine. Organizations are moving from traditional intranet systems to AI-based intranet. So, let’s try to cover everything which you should know before you get started with Project Cortex and SharePoint Syntex.

Project Cortex:

Project Cortex is a new Microsoft Technology that acts as a Knowledge Network for your organization. The new technology takes existing MS Graph, Search, SharePoint, etc., and introduces AI to change the way data is processed. We will no longer need to go searching for knowledge. Cortex will surface for you in the context of your everyday use of Office Applications on the Web, Mobile, and Desktop.
At this moment, two Microsoft Products are available as a part of Project Cortex.
  • Microsoft Viva
  • SharePoint Syntex
During this webinar, we will focus more on SharePoint Syntex. So, let’s try to understand the concepts for SharePoint Syntex.

SharePoint Syntex:

Microsoft SharePoint Syntex is one of the Products of Project Cortex which allows us to use advanced AI and machine teaching to amplify human experiences to automate content processing and transform content into knowledge. At this moment SharePoint Syntex provides us following functionality.
  • Content Processing (Document Understandings)
  • Content Understanding (Form Processing)
  • Content Compliance 
Let’s check some real-life use cases and examples for different Document Understanding models and Form Processing model in SharePoint Syntex.

Document Understanding with SharePoint Syntex:

Let’s say if we have unstructured documents in a form of Letters, Contracts and Resume and we want to extract and classify useful information from those unstructured documents and convert to structured document, at that time the concept of Document Understanding helps us a lot!

Document Understanding model uses AI to convert unstructured data to structured format by performing classification and extraction on it.

Real-Life Use case and Scenario for Document Understanding model:

  • HR System
  • Educational Institutes
Please check the entire webinar for functional and technical implementation of Document Processing Model.


Form Processing Model with SharePoint Syntex:

Let’s say if we have semi-structured documents in a form of Key-Value Pair or table structure data in form of Forms or Invoices, at that time, the concept of Form Processing Model helps us a lot!

The Form Processing Model is built on PowerApps AI Builder which also uses AI and Machine teaching technology to convert our semi-structured documents to structured format.

Real-Life Use Cases and Example for Form Processing Models:

  • Healthcare Organizations
  • Sales or Finance Institutions
Please check the entire webinar for functional and technical implementation of Form Processing model.

Chapters for this Session:

  • Overview of Project Cortex
  • Architecture overview of Project Cortex
  • Products for Project Cortex
    • Microsoft Viva
    • SharePoint Syntex
  • Overview of SharePoint Syntex
  • Real-Life Use Cases and Examples for Document Understanding with SharePoint Syntex
  • Real-Life Use Cases and Examples for Form Processing with SharePoint Syntex
  • Difference between Document Understanding model Vs Form Processing Model

Recording of Session:

Conclusion:

This is how we can leverage the capabilities of AI with Project Cortex and SharePoint Syntex. It’s a true Power of AI with our traditional SharePoint. Isn’t that amazing? Happy SharePointing!!
  
If you have any questions you can reach out our SharePoint Consulting team here.