SharePoint 2016 Hybrid Search Configuration


The Microsoft Search functionality provisions the end user to search a wide range of content like documents, images, videos, audios, etc. within a SharePoint site. In SharePoint On-premise, a user can configure the Search Service Application and crawl the content of the various sites. While SharePoint Online provides both modern and classic search experience to an end user.

Nowadays, users are using the different version of SharePoint On-premise and there is need to get the content of one version into another. To achieve this, SharePoint development team is providing support to crawl the content from the below versions refers below the table.

Sr.NoSP VersionSupported Crawl SP Version
1SharePoint Server 2013SharePoint Server 2007 and SharePoint Server 2010
2SharePoint Server 2016SharePoint Server 2007, SharePoint Server 2010 and SharePoint Server 2013

Users are also using SharePoint On-premise and SharePoint Online, so there is a need to search the content among them. The content is searched inside the SharePoint server and Office 365 separately and they have their own search index repository.

Without Hybrid Search

Microsoft has introduced a concept of the cloud hybrid search and in this concept, the crawled content is indexed in the search index which resides in the Office 365.

With cloud hybrid search

Let’s configure the Cloud Hybrid Search with Office 365 and SharePoint 2016, and understand it in more depth.

Pre-requisites before configuration

Below are the pre-Requisites which are needed to be fulfilled before configuration of SharePoint 2016 Hybrid Search.

Register a public domain with Office 365

There is a default domain in XXXX.onmicrosoft.com format when a user signs up for the Office 365. This default domain works perfectly fine for the trial version and to carry out some testing on an environment. When there is a circumstance in which a user is required to deploy the Office 365 service to an organization, the user must require to use a custom domain thus the customers and users can identify the organization by URL itself.This procedure contains three main tasks:

1.Add a Domain

  • Go to Office 365 Admin and click on the Domains tab by expanding the Setup section.
  • Click on Add domain from Domains page.Add Domains
  • Specify the name of the domain in the text box and click on Next.Specify the name of the Domain

2.Verify Domain

  • The next step after adding a domain is to verify it.
  • There are two ways to verify the domain:
    • Sign in to GoDaddy (recommended)
    • Add a TXT record instead

    Add a TXT record

  • Based on a user’s requirement, he can choose any one of the verification approaches. Here, we are proceeding with the recommended approach i.e. Sign in to GoDaddy.
  • Log into GoDaddy and confirm access for Office 365 to makes changes to the domain at GoDaddy.
  • GoDaddy automatically contacts to the Domain registrar and also proceed with the verification.
  • After the verification, it displays the success message.

3.Update the DNS Settings

  • Once verification is completed, update the DNS settings. For updating DNS settings, again there are two options to provision it and they are:
  1. Add the DNS records for me (recommended)
  2. I’ll add the DNS records myself.
  • Based on a user’s requirement, he can update the DNS settings by choosing any option. Here, we are proceeding with the recommended approach i.e. Add the DNS records for me and click on Next.

update dns settings

  • From “Choose your online services” screen, check all 3 options (Exchange, Skype for business and Mobile Device Management for Office 365) and click on Next.

Choose your online services

  • Provide valid credentials in the Domain Manager Login screen and click on Sign In.Domain manager
  • It displays the DNS records which are added to the newly created domain at GoDaddy and click on Next button.

next update dns setting

  • It displays the success message. Click on Finish.

Add User on newly created domain

To add a new user in the newly created domain walkthrough the below-mentioned steps.

  • Click on Users Active users from Left panel.
  • From Active users page, click Add a user.add a user
  • Enter requires details for a new user and choose the newly created domain. Click on Add.add a user fig 2
  • The new user is listed on the Active user’s page. Click on the newly created user.new user on active users page
  • Click on Manage roles.Manage roles
  • Select the user role as Global administrator & save it.Global administrator
  • Add a UPN Prefix to local AD that matches the public domain

    • Select Active Directory Domain and Trusts from the Server hosting the Active Directory.
    • Right click on the root node and select Properties.Right click on the root node and select Properties.
    • This will open up the below window. In this add the public domain which is registered earlier with Office 365 and click on OK.ok window
  • Add a user to local Active directory

    • Open the Active Directory Users and Computers.
    • Click on the user and follow the below image to add a new user.add image to server
    • Enter the details of a new user and click on Next.Enter details of a new user
    • Type password for the new user & check Password never expires check box. Click Next.type a password, check never expiers checkbox
    • The last screen summarized the details of the newly created user to verify it. Click Finish if every detail is proper.details of newly created user
    • Now right click on the newly created user and click Properties.properties
    • Open the “Account” tab & select the domain which is earlier added as “UPN Suffix” from the dropdown and click OK.upn suffix
    • Add the newly created user in “Enterprise Admins” group. Open the Member Of tab and click Add.Enterprise admins
    • Enter “Enterprise Admins” and click OK.Enterprise admins configuration
    • Now the user is added on Enterprise Admins group. Verify it and click OK.Verify Enterprise admin group
  • Sync Local Active Directory with the Azure Active Directory

    For this action, a user must have active Azure Subscription and access to Azure AD. To synchronize follow below steps:

    • Download “Azure AD Connect” from here.
    • Click on downloaded setup to start the installation. Agree to terms and conditions, and click Continue.Welcome AD Azure connect
    • Click on “Use express settings”.Express settings
      Express settings 2
    • Here provide the credentials of Office 365 account which is created in the newly configured (HybridSearch.anasource.com) domain.credentials of office 365, newly created domain
    • Enter the credential of the Local AD user which is under the newly created domain (e.g. domain/Sp2016User).enter credentials of Local AD
      Note: Here to perform an Azure AD sign in, the UPN prefixes which we had added to the on premise Active directory should match with the verified public domain in Azure (Hybridsearch.anasource.com).

      • Check for the newly created domain must be verified and click on Next as shown in below image.

      Note: If any other dummy domain is there and it’s not verified then it’s ok. Check the checkbox for “Continue without matching all UPN suffix to verified domains”.Azure AD signin configuration

      • Click on Install to start the synchronization process. 

      Installation start

    • Finally, the configuration has completed, click on Exit.configuration complete
    • Head over to Office 365 to check the synchronization status. All the On-premise users have been added to Office 365 as part of the synchronization process. Click Users  Active users  Refresh and check On-premise users.Active users
  • Configuration of Cloud Search Service Application

    Create Cloud Search Service Application from UI
    To create a Cloud Search Service Application follow below steps in SharePoint Server 2016 machine:

    • Open the Central Administration as administrator.
    • Go to Application Management  Manage service application.
    • Manage service application

    • Click New > Search Service Application.

    Note: It’s quite similar to the process of creating a normal Search Service Application except that user have to select an extra checkbox ‘Cloud Search Service Application’ to make it Cloud Search Service Application.
    Give the name to search service application and click OK.

    • Give the name to search service application and click OK.
    • create new search service application

    • Now, a user can verify the search service is created or not from the “Manage service Application page”.

    Connect Cloud Search service application to Office 365 tenant
    To complete the Cloud Hybrid Search set-up, a user must require to connect the created Cloud Search Service Application to the Office 365 tenant. Microsoft has provided the script to automate the On-boarding of the Cloud Search Service Application and Office 365 to the Cloud Hybrid search. A user can get the script named “Onboard-CloudHybridSearch.ps1” from here.
    onboard cloud hybrid search

    In order to run the Onboard-CloudHybridSearch.ps1 script, we have some prerequisites that need to be completed:

    • Microsoft Online Services Sign-In Assistant
    1. Download Microsoft Online Services Sign-In Assistant from this link.
    2. Select the 64-bit version.
    3. Run the downloaded set-up and accept the agreement to install.
    • Install PowerShell for Azure Active Directory
    1. Open Windows PowerShell in administration mode and type following command:
      Install-Module –Name Msonline
    2. Optional: In case, if it gives error please follow below steps:
      Install 64-bit version PackageManagement PowerShell Modules Preview from this link

    3. After installing the above package, re-type following command in Windows PowerShell:
      Install-Module –Name Msonline
    4. Press yes, if it asks any question.

    windows power shell

    • Run the On-boarding Script

    In order to complete the on-boarding of Cloud search Service Application and Office 365 on to Cloud hybrid search follow below steps.

    1. Run the Onboard-CloudHybridSearch.ps1 script in the SharePoint Management shell with the administrator.sharepoint administrator management shell
    2. It will ask for few parameters:
      • Portal URL: Specify the SharePoint Online URL of the organization.
        • Administrator Credentials: It will also ask for the Office 365 global administrator credentials. Enter credentials and click OK.enter office 365 office credentials
        • This will complete the Onboarding process and will register the Cloud hybrid search.complete the onboarding process
  • Create a content source to crawl for cloud hybrid search.

    • As a final step in configuring the Cloud hybrid search, a user is required to create a content source and run a full crawl in SharePoint 2016 On Premise Server.
    • Click the Cloud Search Service Application which was created from Central Admin in 6.1 section.
    • It will open the Search Administration page. Select Content Sources under Crawling from the left navigation pane. Skip to main content Skip to toolbar About WordPress Tatvasoft Australia Blog 2020 comments awaiting moderation New View Post SEO Enter a focus keyphrase to calculate the SEO score G'day, TatvaSoft AU Developer Log Out WordPress 5.0.3 is available! Please notify the site administrator. Edit Post Add New Post draft updated. Preview post Enter title here Permalink: https://www.tatvasoft.com.au/blog/sharepoint-2016-…ch-configuration/ ‎ 8 ol » li » ol » li » ul » li 2 Word count: 1718 Draft saved at 8:33:43 pm. Last edited by TatvaSoft AU Developer on January 28, 2019 at 4:52 pm Preview (opens in a new window) Status: Draft Edit Edit status Visibility: Public Edit Edit visibility Revisions: 23 Browse Browse revisions Publish immediately Edit Edit date and time Readability: OK SEO: Not available Move to Trash All Categories Most Used Web Development Application Development ASP.NET Development BizTalk Development Cloud Computing Ecommerce Development Google iPhone Development JAVA Development mCommerce Development Mobile App Development PHP Web Development RIA Development Search Engine Optimization SharePoint Development Software Development Company Web Design Web Development Australia + Add New Category Add New Tag Separate tags with commas Go Premium Content optimisation Enter a focus keyphrase to calculate the SEO score Social SEO title preview: SharePoint 2016 Hybrid Search Configuration - Tatvasoft Australia Blog URL preview:https://www.tatvasoft.com.au › blog › sharepoint-2016-hybrid-search-configuration Meta description preview: Please provide a meta description by editing the snippet below. If you don’t, Google will try to find a relevant part of your post to show in the search results. Thank you for creating with WordPress. Version 4.9.9 SharePoint 2016 Hybrid Search Configuration - Tatvasoft Australia Blog Add Media Filter by type Filter by date Search Media Attachment Details search-administration.png January 28, 2019 32 KB 602 × 491 Edit Image URL Title Caption Alt Text Description Smush 3 images reduced by 23.8 KB ( 23.9% ) Image Size: 32.4 KB View Stats Attachment Display Settings Alignment Link To Size 1 selected
    • From the Content Sources page, create New Content Source. This will open up the page, where a user can provide the Content Source Name, its type and the start addresses i.e. site URLs from where the crawling needs to start.add new content source
    • A user can also schedule the incremental and full crawls to take place in the Server.crawl schedules
    • The incremental crawl is scheduled to run daily, weekly or monthly. We have set the incremental crawl to run daily at 30 minutes intervals.manage schedules
    • On the other hand, the full crawl can also be scheduled to run daily, weekly or monthly. We have set it to run every day at 12 AM.manage schedules 2
    • After scheduling the crawls, the configuration will look like as shown below in the image.crawl configuration
    • Now, let’s go ahead and run a full crawl.complete crawl configuration
    • We are running the craw for the first time so even if we click on incremental crawl then also a full crawl will take place and the time taken will depend upon the amount of the content within the content source.
  • Test results

      • Once the crawling has completed on the above step, login to SharePoint online site.
        Note: Login user must be inside the configured domain (ex: Hybridsearch.anasource.com)
      • Now search for IsExternalContent:1.
      • ‘IsExternalContent: 1’ is a property, which gives the search results only from the On Premise environment. This will list search results from SharePoint 2016 On Premise Server in the SharePoint Online Search Page and thus indicates a successful Hybrid Search Configuration.

      isExternalContent Property

  • Conclusion

    The Cloud Hybrid Search furnishes the content of both SharePoint On-premise and Office 365 to be available for an end user in unified search results. An end user does not require to panic for the search index as it is in the Office 365 and also not require to migrate the search index to the newer version of SharePoint servers as it is provisioned by Office 365 automatically. A user also experiences the SharePoint Online search without updating existing SharePoint servers.

  • 10
    Communication hub for teamwork – Microsoft Teams + SharePoint Online

    Lately, we have been using collaboration tools depending on the type of communication. When it comes to Microsoft space, we use

    1. Outlook and Exchange for persistent messaging.
    2. Lync/Skype for Business for real-time communication.
    3. SharePoint for effective document sharing and team collaboration.

    A new-gen collaboration tool

    Above tools work in sync to cater our communication need whether it is message based, real-time or documents and other information sharing across boundaries. They work relative to each other but still they’re separate programs which we have to run and juggle between continuously. It demands a lot of context switching to access information organized in each tool i.e. to view email in Outlook or Exchange, Skype for chat and SharePoint workspace to access files or pages. Microsoft Teams aka Teams brings together all these facets of communication under a single roof.

    Benefits of Microsoft Teams include:

    • Real-time and quick access to messages, documents, notes, and meetings.
    • Communication with teammates who are online.
    • Reducing the need to send redundant emails while it provides a notification for uploaded documents across the channel.
    • Conversation across or outside the organization through chats, meetings, file sharing, host audios, videos, and conference calls, thus relegating the need to send information using Skype or Outlook.
    • Share and host files with Office 365 apps such as SharePoint, Word, Excel, Power BI and more.
    • Increase teamwork and productivity by integrating Microsoft and various third-party services.
    • Security and compliance capabilities.

    Relation with SharePoint

    Both Microsoft Teams and SharePoint team site are common in a way that both are streamlined by topic, project, collaboration or team of people. Teams and channels often follow a structure that is similar to the SharePoint team and project sites. To store the channel documents, it is adamant with the fact that every Microsoft Team has a modern team site working in SharePoint development. Also, there is an associated folder inside SharePoint document library for each channel in Microsoft Teams.


    SharePoint documents in MS Teams

    There are a number of positive collaborating Teams’ documents in SharePoint. Files in Teams are easily discoverable in SharePoint search. SharePoint supports previewing documents for more than 300 file types which can be accessed directly from the Files tab in MS Teams. Users don’t have to juggle between tabs to access their files as there is an “Open in SharePoint” option that browses to the SharePoint modern team site.

    SharePoint search

    SharePoint Pages in MS Teams

    You can also add SharePoint page as a tab in MS Teams. Building a tab is a much simpler approach compared to the typical approach of building a whole website. SharePoint team site’ home page can appear in the same user interface thus providing the intuitive user experience.

    Add SharePoint page

    It also provides an interface to add the whole document as a tab that is easily accessible by all the members in a team.

    Sharepoint framework extension

    Conversations and News

    SharePoint’ Discussion and Newsfeed lists satisfy conversations to some extent but due to their usability issues, they were never able to satisfy most customer needs. Now it is also possible to integrate Yammer with SharePoint within Office 365 but it does not provide an extensive approach.

    You can directly have a conversation regarding a document and other shared information in MS Teams.

    SharePoint’s Discussion

    The conversation is also shown directly under the Conversations tab in the channel so that all the members of the team are aware of it.

    Conversations tab

    Microsoft Teams also bubble up team news that helps transcend the conversation. To easily highlight an update and announce news items. SharePoint news can be configured as messages in the conversation thread and Modern SharePoint news as web parts in hub sites.

    SharePoint news

    How to determine if your SharePoint site is connected to MS Teams?

    First, you need to know whether you are on a modern or classic team site collection.

    Click on the Settings gear on the root site to find Site information option is available or not. If you cannot see the option, you have a classic page on a classic site.

    Classic Vs Modern

    Classic Vs Modern Page

    If Site information option is available, you are sure that you have a modern page. But wait, still, you may have a classic site. Click Site information link. A panel Edit site information will be opened on the right. If it contains Privacy settings then you have a modern team site connected to an Office 365 group. If not, you have a classic team site containing a modern page.

    Classic site vs Modern Site

    Site information panel – Classic site (modern page) vs modern site

    Now, you can easily determine if you have a classic or a modern team site. To add a Team for a classic site, you need to groupify the site by adding an Office 365 group. For modern team site or classic team site after adding Office 365 group, you can easily add a Team.

    Connect Office 365 group with the classic team site

    You can control whether global or SharePoint admin can connect classic team site to Office 365 group.

    • Log in to Office 365 using global or SharePoint admin account.
    • Click app launcher icon at the top-left corner and select Admin to open Office 365 admin center.

    Launcher icon

    • From the left pane, select SharePoint under Admin centers to open SharePoint admin center.

    Admin centers

    • Select Settings from the left pane.


    Select Settings

    • Click Allow site collection administrators to connect sites to new Office 365 groups option next to Connections from sites to Office 365 groups property. Click OK to save the changes.

    Allow site collection administrators

    Once the setting is applied, it enables site collection administrator to connect classic team site to Office 365 groups and an option to create a team with Microsoft Teams.

    • Select Connect to new Office 365 Group from Settings menu.

    Connect to new Office 365 Group

    • Click on the link from the group creation experience and select Let’s get started.

    Group creation experience

    • If needed, update group name and email address and change privacy settings. Select the Connect group.

    Connect group

    • Add additional owners and members, if needed inside Add and assign people panel. Click Finish to open new site home page.

    Add and assign people

    Create a team from an existing Office 365 group in Microsoft Teams

    • Navigate to Microsoft Teams and click Join or create a team at the bottom. Then click Create a team button.

    Create a team

    • To create a team based on the created group, click Create a team from an existing Office 365 group.

    Create a team from an existing Office 365

    • Select the newly created group from the list of available Office 365 groups and click Choose team.

    Choose team

    • Click + sign to add the home page as a tab to the channel.

    Add the Tab

    • Choose “SharePoint” and select a page to display.

    Select a page to display

    • As a result, the home page is displayed perfectly as a new tab.

    SharePoint web parts as tabs

    You can use SharePoint Framework web parts as tabs in MS Teams. This will leverage SharePoint users to use Teams tab to easily reach their web-parts. This considerably eases Teams tab building process as the hosting of SharePoint Framework web parts is automatic without having to call external services. The tab also provides familiar web part edit panel to set tab properties.

    Surfacing your SharePoint Framework solution as a Microsoft Teams tab

    You can build Microsoft Teams tabs using SharePoint Framework v1.8 and later.

    Note: Use npm install -g @microsoft/generator-sharepoint command to install/update to latest SharePoint Framework version. The functionality is only applicable in targeted release tenants.

    Sharepoint command

    Create a new web part project in your framework environment

    • Create a new web part by following Step 2 – To Create SPFx web part from this link.
    • One can do modification in the Web Part as per his/her requirement.

    Packaging and deploying your web part to SharePoint

    Make sure that you are in the project directory inside the console.

    • Bundle your solution by executing below command

    gulp bundle –ship

    Gulp bundle

    • Package your solution by executing below command

    gulp package-solution –ship

    Gulp package-solution

    The above command creates a package teams-tab-webpart.sppkg in sharepoint/solution folder in your project directory.

    Creates a package teams

    Now, you will need to deploy the generated package inside your tenant app catalog.

    • Navigate to the app catalog site for your tenant.
    • Upload or simply drag and drop the client-side package to the app catalog i.e. Apps for SharePoint list.

    Apps for SharePoint

    SharePoint prompts a dialog to deploy client-side solution package because this is a full-trust solution.

    You can observe that the domain in the dialog says SharePoint Online because the content is rendered from the Office 365 CDN or served up from tenant app-catalog, based on tenant settings.

    • Click Deploy.


    Please note that there are no error messages inside the App Package Error Message column inside the app catalog.

    Once deployed, the web part is directly available across SharePoint Online sites.

    Packaging and deploying your web part as a Microsoft Teams tab

    Your tenant needs to support Side Loading of external apps for Teams in order to deploy an app. You need to explicitly deploy Microsoft Teams app to a Team.

    Below setting has to be enabled only once in a tenant to configure side-loading of apps in Teams.

    Select Admin inside the app launcher to navigate to Microsoft 365 admin center.

    Launcher icon

    Select Services & add-ins option under Services from the left menu.

    Services & add-ins

    Choose Microsoft Teams from the list of available services you can manage.

    Microsoft Teams

    Under Tenant-wide Settings, expand Apps.

    Tenant-wide Settings

    Note that the setting Allow sideloading of external apps is enabled under External Apps.

    External Apps

    Click Save to save the changes.

    Save External Apps

    Once we confirm that the side-loading is enabled, we can package Teams application to configure SharePoint Framework tab available in Microsoft Teams.

    • Navigate to the Teams folder in the project directory for your solution.

    Navigate to the Teams folder

    • Create a zip file MyFirstSPFxTab.zip consisting manifest.json file and the images file in your preferred location.

    Create a zip file

    Please note that manifest and images files should be at the root of the newly created zip file, else deployment will fail.

    • Navigate to Microsoft Teams for your tenant by selecting Teams in the app launcher.

    Select Team in launcher

    • Select a team you want to use to test the functionality and click Manage Team from the … menu.

    Manage team

    • Navigate to the Apps tab.

    Navigate to the Apps tab

    • Click Upload a custom app from the bottom-right corner of Apps page.

    Upload a custom app

    Note: In the case where the setting is not available, verify whether sideloading is enabled in your tenant.

    • Open MyFirstSPFxTab.zip from the Teams folder under your project directory.

    Open Teams folder

    • Make sure whether the app is visible in the list of available apps. You can observe a custom image along with the description of the solution.

    Observe a custom image

    • Go to a channel under the team where you uploaded the zip file.

    Go to a channel under the team

    • Click + in order to add a new tab to the channel.

    Add a new tab to the channel

    • Select your newly created custom tab MyFirstTeamTab from the list of available apps.

    Newly created custom tab

    • Observe “MyFirstTeamsTab” dialog containing exposed properties to parameterize the tab.

    Observe MyFirstTeamsTab dialog

    Note: You may be unable to change default properties of the tab or there may be issues adding a web part to the tab, as there is a known bug expected to be addressed by Microsoft in upcoming days.

    You can see the code rendering in Microsoft Teams context after adding the custom tab on the channel. Web part theme will be as per respective SharePoint site.

    Welcome To Teams


    MS Teams provides an effective way for users to collaborate in a team hub by bringing SharePoint functionality into it. By now, you know that SharePoint Online and Microsoft Teams are better together!

    Sharepoint On-premise – Create User and Assign in AD & SP groups

    In the real world, the HR department is responsible in any organization to appoint new employee. Once he/she appoints any employee then he/she requires to contact Network Administrator and SharePoint Administrator. A Network Administrator creates this user in the AD, assign him into OU (if require) and AD group, and a SharePoint Administrator assigns this user into appropriate SharePoint group to provide him access on the organization SharePoint site. Thus, a chronological sequence is required to follow and it is time-consuming.

    If HR department is having appropriate permission to access the organization SharePoint site then they can perform the tasks on behalf of Network and SharePoint Administrators through SharePoint itself via a web-part, an application page or an event receiver. Thus, the HR department can get rid of the above chronological sequence.

    Before providing access to a new user in a SharePoint site, an organized user is required to perform certain steps as mentioned below:

    1. Create a user in Active Directory
    2. Add a user in Organizational Unit (if require)
    3. Add a user in Active Directory group
    4. Add a user in a SharePoint group

    Ideally, the Active Directory tasks (steps 1 to 3) are performed by a user who is having permission on Active Directory Domain Services. Step 4 can be performed by a user who is having access to manage users in SharePoint groups of a SharePoint site.

    Let’s see how one can provide this functionality in SharePoint site.

    Note: The yellow highlighted points in below code are configurable as per the user requirement. This information must be kept somewhere where one can easily manage them. E.g. web.config, app.config, SharePoint list etc. 

    Code Example

    Let’s create a console application in C# to create users in the AD and assign them into SharePoint Group. The developer can also add a piece of code in SharePoint web-part, an application page or an event receiver with required modification.

    First, get all the required user information from an end user and use them to create a user.

      // fetch the user details from input  
                    Console.Write("Enter First name: ");
                    var firstName = Console.ReadLine();
                    Console.Write("Enter Last name: ");
                    var lastName = Console.ReadLine();
                    Console.Write("Enter Login name: ");
                    var loginName = Console.ReadLine();
                    Console.Write("Enter Employee ID: ");
                    var employeeID = Console.ReadLine();
                    Console.Write("Enter Email: ");
                    var email = Console.ReadLine();
                    Console.Write("Enter Phone number: ");
                    var phoneNumber = Console.ReadLine();
                    Console.Write("Enter Address: ");
                    var address = Console.ReadLine();
                    AddUserInSharePoint(firstName, lastName, loginName, employeeID, email, phoneNumber, address);
           catch (Exception ex)
                Console.WriteLine("Error: " + ex.Message);

    Add User in SharePoint

    public static void AddUserInSharePoint(string firstName, string lastName, string userLogonName,  string employeeID, string emailAddress, string telephone, string address)
          bool status = CreateUser(firstName, lastName, loginName, employeeID, email, phoneNumber, address);
          if (status)
                PrincipalContext AD = new PrincipalContext(ContextType.Domain, "your     domain", "User Name", "Password");
                UserPrincipal u = new UserPrincipal(AD);
                // search for user  
                PrincipalSearcher search = new PrincipalSearcher(u);
                UserPrincipal result = (UserPrincipal)search.FindOne();
                //Enter user to SharePoint group
                if (result != null)
                      AddUserToDirectoryGroup(result.UserPrincipalName, "AD Group Name", "Your Domain", "DC=DC,DC=DC");
                      AddUserToSharePointGroup(result.SamAccountName, "SP Group Name"); // SamAccountName = User's AD login name
       catch (DirectoryServicesCOMException ex)
          Console.WriteLine("Error: " + ex.Message);

    Create User

    private static bool CreateUser(string firstName, string lastName, string userLogonName,  string employeeID, string emailAddress, string telephone, string address)
       // Creating the PrincipalContext
       PrincipalContext principalContext = null;
        principalContext = new PrincipalContext(ContextType.Domain, "your domain", "DC=DC,DC=DC");
        catch (Exception ex)
             Console.WriteLine("Error: " + ex.Message);
             throw ex;
        // Check if user object already exists in the store
        UserPrincipal usr = UserPrincipal.FindByIdentity(principalContext, userLogonName);
        if (usr != null)
             return false;
        // Create the new UserPrincipal object
        UserPrincipal userPrincipal = new UserPrincipal(principalContext);
        if (lastName != null && lastName.Length > 0)
        { userPrincipal.Surname = lastName; }
        if (firstName != null && firstName.Length > 0)
        { userPrincipal.GivenName = firstName; }
        if (employeeID != null && employeeID.Length > 0)
        { userPrincipal.EmployeeId = employeeID; }
        if (emailAddress != null && emailAddress.Length > 0)
        { userPrincipal.EmailAddress = emailAddress; }
        if (telephone != null && telephone.Length > 0)
        { userPrincipal.VoiceTelephoneNumber = telephone; }
        if (userLogonName != null && userLogonName.Length > 0)
        { userPrincipal.SamAccountName = userLogonName; }
        string pwdOfNewlyCreatedUser = "abcde@@12345!~"; //Random or auto-generated password can be assigned.
        userPrincipal.Enabled = true;
        catch (Exception ex)
           Console.WriteLine("Error: " + ex.Message);
           return false;
        if (userPrincipal.GetUnderlyingObjectType() == typeof(DirectoryEntry))
           DirectoryEntry entry = (DirectoryEntry)userPrincipal.GetUnderlyingObject();
           if (address != null && address.Length > 0)
           { entry.Properties["streetAddress"].Value = address; }
           catch (Exception ex)
              Console.WriteLine("Error: " + ex.Message);
              return false;
        return true;

    Add User to Directory Group

    public static void AddUserToDirectoryGroup(string userId, string groupName, string domain, string domainController)
          using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain, domainController))
             GroupPrincipal group = GroupPrincipal.FindByIdentity(pc, groupName);
             group.Members.Add(pc, IdentityType.UserPrincipalName, userId);
       catch (DirectoryServicesCOMException ex)
          Console.WriteLine("Error: " + ex.Message);

    Add User to SharePoint Group

    private static void AddUserToSharePointGroup(string userLoginName, string userGroupName)
        //Executes this method with Full Control rights even if the user does not otherwise have Full Control
            using (SPSite spSite = new SPSite("Your site url"))
                using (SPWeb spWeb = spSite.OpenWeb())
                        //Allow updating of some sharepoint lists, (here spUsers, spGroups etc...)
                        spWeb.AllowUnsafeUpdates = true;
                        SPUser spUser = spWeb.EnsureUser(userLoginName);
                        if (spUser != null)
                            SPGroup spGroup = spWeb.Groups[userGroupName];
                            if (spGroup != null)
                    catch (Exception ex)
                        Console.WriteLine("Error: " + ex.Message);
                        spWeb.AllowUnsafeUpdates = false;


    On successful execution of the AddUserInSharePoint method, the user will be added to the Active directory. You can verify the same by logging into the Active Directory. Refer the below screenshots for same.

    Active Directory

    Test User Properties

    On completion of AddUserToSharePointGroup method, the user will be added to a SharePoint group as shown in the screenshot below.

    SharePoint group


    A new user can be created and assigned into the respective AD and SharePoint groups by a user who is having appropriate permission on a SharePoint site. The various information related to the user which is provided at a creation time can be viewed in SharePoint if the User Profile Synchronization Service is configured. Various operations can be performed in AD and SharePoint related to a user management.

    Implementing Offline Capability in PowerApps with SharePoint- Part 2

    This blog is a continuation in the series of blogs for implementing offline capability in PowerApps with SharePoint.

    In the first part, we streamlined the process to enable and configure offline capabilities in your applications.

    Implementing Offline Capability in PowerApps with SharePoint- Part 1

    The blog caters the information regarding the basic idea of PowerApps which is a tool for building the mobile apps. While creating the blog we have assumed that you have a good knowledge regarding the PowerApps so only the brief information is provided considering the same and implementation steps are mentioned right from the scratch.

    Implementing Power BI with SharePoint Online

    What is Power BI?

    Power BI is a collection of hundreds of connectors that work together to turn the unrelated sources of data into coherent, attractive and interactive insights. It converts your data from different data sources to interactive dashboards and attractive reports. Power BI provides services – Power BI desktop, services based on SaaS, hundreds of connectors and Power BI mobile apps for different platforms. Whether your data is stored in an Excel workbook or stored in SQL servers or in a collection of cloud-based plus on-premises hybrid warehouses, Power BI allows you to connect different data sources, convert it to meaningful insights and share that with anyone.

    Event Tracking in Google Analytics with SharePoint Online

    Google Analytics enables you to optimize your advertising ROI and track your sites and applications. It helps you get a better understanding of your business’ stakeholders. Google analytics brings with it open-source tools to analyze data for your applications.

    Remote Administration of SharePoint with PnP-PowerShell

    From the title of the blog, the first question comes in mind is “What is PowerShell?”

    The answer is: It is an object-oriented automation engine and scripting language developed by Microsoft and built on the .Net framework. It has an interactive command-line shell where the user can execute commands to fulfill their tasks.

    SharePoint 2013 Variations

    Huge organizations have many people working in the same organization in different regions across the globe having different languages for communication. In general scenario regional language is more in to preference. As internet facilities are now easily available, websites are the most favorable and less expensive equipment for marketing purpose. Websites should be capable enough to provide content suitable to their target audiences across the globe. But maintaining the different sites with different languages is very difficult for content redundancy point of view.

    How to Implement Remote Event Receiver in SharePoint Online

    The scenario to deal with creating files in document libraries, adding/updating/deleting items in the SharePoint list, at times requirement emerges to perform some action on such events like sending notification, data manipulation on SharePoint lists or libraries, etc.

    Enrich SharePoint Development with Chatbots

    Terms like Chatbot, Artificial Intelligence and Personal Assistants are in trends since past few years. All major companies have initiated to incorporate such intelligent techniques in their respective business verticals. Like – more than 11,000 chatbots in Facebook messenger app, since April 2016 and many other examples are also available in the market.

    Chatbots concept is growing as the latest standard of automation in the software development by simplifying the method for a user to receive desired information. Persona/avatar – Chatbot increases work productivity, offers information, boost ROI and decreases the searching time for B2C, B2B and B2E type of organization software solutions. Chatbot not only reverts back in text format but also in form of images, files, videos, etc.

    Office 365 is emerging rapidly in Enterprises

    “The cloud” allows to securely access web-based computing services that reside off-premises and are supported by the third party. The Advent of cloud era is looming nowadays as cloud-based services can be accessed virtually anywhere and on any device with an internet connectivity.

    In this cloud era, Microsoft surprised enterprises and developers with Office 365. In Office 365, right from information storage to computation and software are maintained and established remotely on the secured servers possessed by Microsoft. Most recent features of Office 365 – SharePoint Development, Delve, Yammer and Dynamics 365, a Cloud-based solution, nowadays are availed by clients/organization to enhance business collaboration.

    What does the future of SharePoint hold?

    SharePoint would continue to be a very effective platform for business use and for many more. The enhancements only serve to boost the performance of the platform.

    When it comes to the future of SharePoint Development, Microsoft would continue to provide on-premises version of the platform as long as there is market demand. Furthermore, Microsoft recognizes that on-premises would be around for some time, if not mostly in a form of hybrid environments.