Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

Sharepoint Integrations

As initial step you will have to create an application registred in Azure Active Directory in your SharePoint online tenant. You have several options to integrate to SharePoint, based on Pull (Graph/Sharepoint API) or Push (SharePoint Webhook) activation models.

Register your application and setup Graph/Sharepoint API permissions

Register your app with the Azure AD v2.0 endpoint - Microsoft Graph | Microsoft Doc

Make sure to cover -

  • Configure Callback URL (in case Sharepoint API is executed from postman use https://www.getpostman.com/oauth2/callback)
  • API Permissions - assign to Graph permissions for both Sites and Files
  • Consent to grant the user the permissions requested

Setup your Postman Settings -

Environment variables:

Postman Collection variables (Use Graph collection-Graph.postman_collection.json):

  • webUrl -> https://<>.sharepoint.com/sites/<your_site>

image

Pull SharePoint changes -

Use Graph API to integrate with SharePoint to poll for changes within a document library

You can check out graph explorer for testing puposes (usefull to make sure your used has appropriate privileges).

https://developer.microsoft.com/en-us/graph/graph-explorer

Use delta operation to captur changes -

Example : https://docs.microsoft.com/en-us/graph/api/driveitem-delta?view=graph-rest-1.0&tabs=http

  • QuerySiteId -> get your site id based on the webUrl defined in the collection variable.
  • QueryDriveId -> get the docuemnts root directory id
  • QueryFiles-delta -> get all changes within lastest token, initial request generates a token that later on is stored as a collection var, you can clear the token var to initiate a "clean" start.

Use query parameter to filter changes based on lastModifiedDateTime

Execute the collection operations ->

Get Push notifications for SharePoint changes by using Webhooks -

Webhooks will allow to create a subscription to a SharePoint object and get notification for changed events. Webhook handler has to be implemented in an A-Sync mode and reply back within 5 seconds, in case the activation of the notification service failes there will be automatic retry for 5 times (https://docs.microsoft.com/en-us/sharepoint/dev/apis/webhooks/webhooks-reference-implementation)

image

Webhook setup

https://learn.microsoft.com/en-us/sharepoint/dev/apis/webhooks/get-started-webhooks

Using Azure Functions with SharePoint webhooks | Microsoft Docs

https://github.com/pnp/sp-dev-samples/blob/master/Samples/WebHooks.List.AzureAD/azure%20functions%20guide.md

Execute the collection operations ->

  • GetDocumentsListid -> get your list id based on parameter set (lists/getbytitle('')?$select=Id)
  • CreateWebhook -> subscribe to capture changes on the list defined in pre command
  • GetListID -> verifies that the subscirption defined exists
  • GetChanges -> get the actual changes done

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors