0

In the documentation Use the Microsoft Graph API to get change notifications, it says:

Using the Microsoft Graph API, an app can subscribe to changes on the following resources:

  • ...
  • Content within the hierarchy of the root folder driveItem on OneDrive for Business
  • ...

There is no explicit mention of SharePoint Online support for file notifications in the documentation, but because the OneDrive for Business and SharePoint Online APIs within the Microsoft Graph are essentially the same, should this infer that the same functionality is supported for SharePoint Online too?

0

As of June 2019, the answer is no.

There is a single endpoint in the Microsoft Graph with which you can create webhooks (subscriptions): https://graph.microsoft.com/v1.0/subscriptions

This is not specific to OneDrive for Business, but common to all applications in the Microsoft Graph (well, those that support webhooks, that is).

The Microsoft Graph Explorer is a great help to test things without writing too much code.

A successful POST to create a webhook looks something like this:

Create webhook on the Microsoft Graph

Note that the resource is me/drive/root for OneDrive for Business. There are no supported resource values for SharePoint Online at this point.


Aside

  1. OneDrive for Business only supports a changeType of updated even though created and deleted are listed as supported values in the documentation.
  2. You can GET the same URL to list current webhooks/subscriptions:

View subscriptions

0

The answer is "yes".

The drives associated with (Sharepoint) sites work the same way as OneDrive for business drive (associated with users).

I can confirm (after testing) that it works in the same manner and that notifications work well. (At least the same as drives associated with users).

To get the drives associated with a site use https://docs.microsoft.com/en-us/graph/api/drive-list?view=graph-rest-1.0&tabs=http

E.g.: GET /sites/{siteId}/drives

This will return the drives IDs associated with the site (there may be multiple, in contrast to OneDrive that has 0 or 1).

You may then apply the API to them as you would any other drive. E.g.: GET /drives/{drive-id}/root/delta

  • How does this push subscription notifications to a webhook URL? What URL would you use to setup the webhook/subscription? – dvdsmpsn Jul 30 at 0:09
  • 1
    The resource will be: drives/{driveID}/root. The changeType will be: updated. About a subscription url, that's up to you. More information is available in the documentation docs.microsoft.com/en-us/graph/webhooks – Tomer Jul 30 at 12:40
  • Thanks. Looking at the page you linked, it says "Using the Microsoft Graph API, an app can subscribe to changes on the following resources" - SharePoint Online drives are not listed. Only OneDrive & OneDrive for Business :( The page is somewhat ambiguous on what is available, so I'll give it another go. – dvdsmpsn Jul 30 at 15:12
  • From the link I sent: "Or to the root folder of a SharePoint/OneDrive for Business drive: /drive/root" – Tomer Jul 30 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.