Issue with OneDrive webhook subscription

Copper Contributor

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"
      }
   ]
}

 

 

Obs.: All my tests are being done using Graph Explorer.

Any helps would be greatly appreciated,

 

Vinicius Paiva

0 Replies