SharePoint / Teams Entra Application for netDocShare Sync Prerequisites

SharePoint / Teams Entra Application for netDocShare Sync Prerequisites

A close up of a sign

Description automatically generated

 

SharePoint/Teams Entra Application for netDocShare Sync Prerequisites


Create the certificate

·       
Generate a self-signed certificate using the PowerShell command below:

$cert = New-PnPAzureCertificate -CommonName "<certificate name>" -OutPfx .\<certificate file name>.pfx -OutCert .\<certificate file name>.cer -ValidYears 2 -CertificatePassword (Read-Host -AsSecureString -Prompt "Enter Certificate Password")

  1. Enter Certificate Password” should be replaced with a password.
  1. Write down this password for future reference as Certificate Password.
  1. After executing the command, find the .cer and .pfx files from the respective path for future usage.

Note: Please ensure that PowerShell version 7.4.4 is installed and run Install-Module PnP.PowerShell -Scope CurrentUse


Create Entra Application

  1. Login to the Azure portal and select App Registrations.

      

  1. ·       Select New registration from the App registrations page.

  1. ·       Fill the following highlighted field values and click Register in the Register an application page.

  1. ·       Go to the Application Overview page after completed the application registered.
    1. Write down the Tenant ID and Entra App ID from this page.
      1. Directory (tenant) ID as Tenant ID
      2. Application (Client) ID as Entra App ID

Generate Authentication

  1. ·       Click the Authentication menu from the left-side menu.

  1. Click Add a Platform.

      

·      
  1. Click Web and then Configure Web.
  2. Enter https://sync.netdocshare.com/assets/spauth/index.html in the Redirect URIs input.
  3. Check the boxes for Access tokens (used for implicit flows) and
  4. ID tokens (used for implicit and hybrid flows).
  5. Click Configure to save the configuration
      

·       
  1. Verify that the Redirect URI was properly added from the Authentication pane.

Add Certificate & Client Secret

Click the Certificates & Secrets menu from the left side.

Upload Certificates   

  1. Click Certificates tab to navigate the CCertificates list
  2. Click Upload certificate.
  3. Add the certificate that was previously created (the .cer file) and enter a description.
  4. Click Add button to complete the upload.

  1. ·       After completing the certificate upload write down the Thumbprint as Certificate Thumbprint.
      
      
      

Create Client Secret

  1. Click the Client Secrets tab   
  2. Click New client secret
  3. Enter the description and choose an expiry date for the client secret in the popup.
  4. Click Add button.
      

·       

  1. After creating the secret write down the secret value as Application Secret and Secret ID.

        

API Permissions (SharePoint Only)

·     

  1. Click API Permissions menu from the left menu,
  1. Click Add a permission and add the following permissions

    1. Microsoft Graph
      1. Site.FullControl.All (Delegated)
      2. User.Read (Delegated)

    1. SharePoint

      1. AllSites.FullControl (Delegated)
      2. Sites.FullControl.All (Application)
      3. Sites.Manage.All (Application)
      4. Sites.Selected (Application)

  1. ·       Click Grant admin consent for {tenantName}

To use the SharePoint/Teams/OneDrive within the same application, please add the below:

  1. Channel.Create
  2. ChannelMember.Read.All
  3.  ChannelMember.ReadWrite.All
  4. Contacts.Read
  5. Contacts.ReadWrite
  6. Directory.Read.All
  7. Directory.ReadWrite.All
  8.  Files.ReadWrite.All
  9. Group.ReadWrite.All
  10. Sites.FullControl.All
  11.  Sites.Manage.All
  12. Sites.ReadWrite.All
  13.  Sites.Selected
  14.  Team.Create
  15.   TeamMember.ReadWrite.All
  16. User.Read (Delegate)
  17. User.ReadWrite.All

Note:

  1. The netDocShare Sync web and desktop applications use Delegated permission
  2. The netDocShare Sync Scheduler application use Application permission.

Adding the SharePoint Connection on netDocShare Sync


  1. Add a new SharePoint connection
  2. Fill in every required field with the values from previous steps

Adding the Teams Connection on netDocShare Sync


  1. Add a new Team connection
  2. Fill in every required field with the values from previous steps

Grant granular access to SharePoint sites (optional)

Prerequisites:

1.  Install Postman to make http requests

     

Set the permissions for the desired site

  1. Open the Postman application
  2. Create a new request and open the Authorization tab

  1. Set the Type to OAuth2.0
  2. Under Configure New Token > Configuration Options, set the following fields:
      1. Grant Type
         to “Client Credentials”
      2. Client ID
         to your Application (client) ID
      3. Client Secret
         to the value of a secret for your App
      4. Scope to offline_access https://graph.microsoft.com/.default
      5. Client the Get New Access Token button and click Proceed, then click Use Token in the top-right

Next, we will configure the request
  1. Change the type in the top-left to POST, from GET
  2. Enter the URL: https://graph.microsoft.com/v1.0/sites/{Site ID}/permissions as the endpoint. Make sure to change {Site ID} to the Site ID that we copied earlier
  3. Click on the Body tab, select raw, then change the type from Text to JSON
  4. Add the following JSON body, and make sure to fill in the {client_id} and {app_name} from the Entra Application that was created earlier
{
    "roles": [
        "fullcontrol"
    ],
    "grantedToIdentities": [
        {
            "application": {
                "id": "{client_id}",
                "displayName": "{app_name}"
            }
        }
    ]
}


  1. Then click Send and you should receive a 201 Created success.

Remove Sites.FullControl.All access

Back on the Azure Application, go to API Permissions and remove both permission and consent for Sites.FullControl.All, for both SharePoint and Microsoft Graph by clicking on the three dots next to the permission

Check that it works

  1. On Postman, create a new request
  2. Keep it as GET and leave the body empty
  3. Reuse the same Authorization setup from the previous section
  4. In the endpoint, enter: https://graph.microsoft.com/v1.0/sites/{Site ID}, replacing {Site ID} with the Site ID we copied earlier
  5. Press Send
If you get a 200 OK response, the access is now set up properly






    • Related Articles

    • netDocShare v4.2.0.1612

      New Features netDocShare Sync Sync deleted files and folders. Sync checkout status Sync selected files and folders in Bidirectional sync. Default meta data column creation for Document type when doc links Export jobs – Export the sync jobs filter by ...
    • netDocShare v3.7.0.0512

      netDocShare SharePoint and Teams Applications Search Enhancement: Added Advanced Search with refinements. Filter: Date Range Selection for Date Column Filter. Filter: Filter Look Up Columns using Name Previously Supported Filter by Key. Document ...
    • netDocShare v4.2.1.20801

      netDocShare Sync Sync Control: Being able to stop or restart a sync job. Custom Display Locations: Change the display location for NetDocuments and Teams or SharePoint in column mapping. Doc Links: Removed the appended NetDocuments ID from the synced ...
    • netDocShare v4.0.0.2002

      New Features netDocShare Ability to perform an advanced search in Go to client matter view. netDocShare Hybrid Search Ability to narrow down the list of search results to the folder level with the config builder settings. Ability to view NetDocuments ...
    • netDocShare OneDrive Client ID and Secret Id Generation

      OneDrive Client ID and Secret Id Generation Step 1: Please open the azure portal in browser https://portal.azure.com/#home Step 2: Please click the “Azure Active Directory Step 3: Once Azure Active Directory open after click the “App Registrations” ...