Share via

Issue with OneDrive webhook subscription

Vinicius Paiva 0 Reputation points
2024-01-23T19:51:18.1633333+00:00

Hello,

I need help with the two issues I encountered using Microsoft Graph API, specifically related to OneDrive webhooks.

Issue 1:

I intend to use a webhook in OneDrive to receive notifications when files inside a specific folder are updated.

However, we have encountered a limitation where it appears that webhook registration is only possible at the root of an enterprise OneDrive. See below the POST that works. If I try to change the resource to a different folder, it fails.

POST /v1.0/subscriptions/
{
    "changeType": "updated",
    "notificationUrl": "[WEBHOOK_URL]",
    "resource": "/me/drive/root",
    "expirationDateTime": "2024-01-24T11:23:00.000Z",
    "clientState": "1234"
}

Issue 2:

The second challenge is with the webhook notifications themselves. Currently, the notifications we receive do not specify which file was updated.

See below the JSON our webhook receives when one file is updated. Notice that inside the "resourceData" the is a generic "DriveItem" without any ID.

{
   "value":[
      {
         "subscriptionId":"##############################",
         "clientState":"1234",
         "resource":"/me/drive/root",
         "tenantId":"##################################",
         "resourceData":{
            "@odata.type":"#Microsoft.Graph.DriveItem"
         },
         "subscriptionExpirationDateTime":"2024-01-24T11:23:00+00:00",
         "changeType":"updated"
      }
   ]
}

Any helps would be greatly appreciated,

Vinicius Paiva

Microsoft 365 and Office | OneDrive | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. Jiajing Hua 18,110 Reputation points Moderator
    2024-01-24T01:55:28.5+00:00

    Hi @Vinicius Paiva

    As your issue is related to OneDrive Development, I suggest you post a new thread on following forum. Microsoft Tech Community --- OneDrive Developer

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.