How to get ordering in events obtained from delta request

User3 40 Reputation points
2024-05-21T16:13:15.9966667+00:00

I am using Microsoft Graph API to access details about files in Sharepoint.

I am using the delta query request to get the list of files updated since my last fetch. Couple of questions -

  1. If there is a file creation operation and then a delete operation and I then make a delta request, I only see the delete event. Is this guaranteed behaviour (that for multiple events on a single file, I will only get the latest state and not the intermediate states)?
  2. If there is a delete operation on a file and then the file is restored from the recycle bin, the restore event's timestamp is the timestamp of the last update to the file. In other words, it is less than that of the delete. The restore event also appears to be indistinguishable from file creation / update events. Is there a way I can order the events correctly (so that restore is ordered after the delete)?
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,920 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,922 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 22,111 Reputation points Microsoft Vendor
    2024-05-22T05:20:38.6666667+00:00

    Hi @User3 ,

    Welcome to Q&A forum!

    Here are the answers to your questions:

    • Delta Query Behavior: The behavior you’re experiencing with delta queries is a known characteristic of the API. When multiple operations occur on a file, such as creation followed by deletion, the delta query will reflect only the last state of that file (in this case, deletion). This is because each operation results in a new version or identity for the file in SharePoint Online, and once an operation completes successfully, previous versions are considered unchanged for subsequent requests. There isn’t a native way to retrieve intermediate states within a single delta request.
    • Event Ordering: Similarly, event ordering can be tricky when dealing with restore operations from the recycle bin or other similar scenarios where events may seem identical but have different implications (such as delete vs. restore). Currently, there isn’t an inherent mechanism within SharePoint or its APIs to order these events differently based solely on their type.

    There is currently no available method to do this, you can investigate customizing the application programming interfaces provided by Microsoft Graph to better suit your specific needs.


    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.


0 additional answers

Sort by: Most helpful