Share via

i am calling subscribe api (https://graph.microsoft.com/v1.0/subscriptions) to get notification if any file is updated but not getting id key in responsedata object .how to file id in responseData object??

Omkar Tambe 0 Reputation points
2024-08-05T08:07:33.56+00:00

i am getting notification object as
{"value":[{"subscriptionId":"85b42efa-685c-4675-a372-ae40ae665b5a","clientState":"SecretClientValue","resource":"sites/zycusitis.sharepoint.com,1d9e3831-f959-4910-99e1-8fc2d2922681,10b34443-c70c-40bb-8ab9-e3b8a58f153c/drives/b!MTieHVn5EEmZ4Y_C0pImgUNEsxAMx7tAirnjuKWPFTxUmO287bDgSqWGWcTmt2gM/root","tenantId":"e59a1851-bfcf-4536-8dd7-bd19f398e625","resourceData":{"@odata.type":"#Microsoft.Graph.DriveItem"},"subscriptionExpirationDateTime":"2024-08-05T07:44:01.143+00:00","changeType":"updated"}]}

i want id(file id) also in resourceData object .

also sharing curl for subscribe api
please help us here

curl --location 'https://graph.microsoft.com/v1.0/subscriptions' \
--header 'Content-Type: application/json' \
--data '{
        "changeType": "updated",
        "notificationUrl": "https://vendor-rp.zycus.com/product-support/api/utility/getNotification",
        "resource": "sites/{siteid}/drives/{driveid}/root",
        "expirationDateTime": "2024-08-05T08:56:20.176Z",
        "clientState": "SecretClientValue"
      }'

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,986 Reputation points Microsoft External Staff
    2024-08-06T10:18:15.85+00:00

    Per my research, not all resources return resourceData within the notification and driveItem is one of these.

    To find out details about updated items you will have to use delta query.


    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.