Issues with Delta Query on Graph API: Loading Only Specific Drive Items

Baki 5 Reputation points
2024-04-26T13:55:24.5633333+00:00

I'm trying to use the Microsoft Graph API to specifically load and monitor only shared items from a drive. I'm following the delta query method described here: Best practices for discovering files and detecting changes at scale

I've tried different settings in the Prefer header like hierarchicalsharing, deltashowremovedasdeleted, deltatraversepermissiongaps, and deltashowsharingchanges, but I always end up loading all the items. I even tried filtering by the shared property, but it didn’t work.

Here's the endpoint I used:
https://graph.microsoft.com/v1.0/drives/{DRIVE_ID}/root/delta

Additionally, the documentation mentions properties like @microsoft.graph.sharedChanged and @oneDrive.sharedChanged for detecting changes in response, but I don’t see these properties in my results even when the changes were detected.

Can someone help me figure out how to set up the delta query to only load shared items and continue monitoring just those items in the future?

Thanks!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,052 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saranya Madhu-MSFT 385 Reputation points Microsoft Vendor
    2024-05-22T16:40:30.9233333+00:00

    Hi Baki,

    Thank you for reaching out!

    I tried to reproduce from my end. It is working as expected.

    Endpoint: https://graph.microsoft.com/v1.0/drives/{DRIVE_ID}/root/delta

    Headers: Prefer: deltashowsharingchanges

    Run the above-mentioned endpoint- https://graph.microsoft.com/v1.0/drives/{DRIVE_ID}/root/delta, I got the response with odata.deltaLink and tried to run the deltalink query after doing the next changes on drive like tried to change the sharing permissions on document library.

    I was able to get the response after sharing permissions has been done. You can refer to the screenshot below:

    User's image Note: In order to process permissions correctly your application will need to request Sites.FullControl.All permissions.

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments