What is the best way to get delta results from sharepoint online document library.

Dilip Reddy Gaddam 1 Reputation point
2022-08-24T21:41:05.327+00:00

We are planning to fetch documents from my share point online document library on regular basis(once in a day). Based on this graph API documentation we got know that we can use delta queries (https://learn.microsoft.com/en-us/graph/api/driveitem-delta?view=graph-rest-1.0&tabs=http) to fetch this information. This document mentions two ways of using delta queries

  1. Using the delta query present in the previous api response which looks like GET /me/drive/root/delta(token='MzslMjM0OyUyMzE7MzsyM2YwNDVhMS1lNmRmLTQ1N2MtOGQ5NS1hNmViZDVmZWRhNWQ7NjM3OTQzNzQwODQ3NTcwMDAwOzU4NTk2OTY0NDslMjM7JTIzOyUyMzA')
  2. Building your own delta token based on the timestamp which looks like GET /me/drive/root/delta?token=2021-09-29T20%3A00%3A00Z

Among these two which is the better approach to find the delta? Are there any performance issues if we use date based delta query, because this is easy to implement without storing delta token from previous execution.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,476 Reputation points Microsoft External Staff
    2022-08-25T05:34:18.563+00:00

    Hi @Dilip Reddy Gaddam
    I will recommend you to use first query. The first query is a request after the initial request. The second query is used in the scenarios that the client only know the state of a drive up to a specific time, but not have a deltaLink for that point in time. In this case, the client can call delta using a URL encoded timestamp for the value of the token query string parameter.
    You can also refer to the document note in following pic:
    234727-image.png
    If you have a deltaLink, it's much recommended to use it directly than retrieving delta results using a timestamp.


    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.



Your answer

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