Search code examples
microsoft-graph-api

How to use graph delta query to get changes in the last 12 months?


I want to use the Graph delta query to get any changed driveItems in the last 12 months, is this possible?

At the moment I seem to have to start from the beginning of time, is there a way to exclude driveItems earlier than 12 months, or do I have to do manual date checks?


Solution

  • You can try to retrieve delta results using a timestamp like

    GET v1.0/me/drive/root/delta?token=2024-06-29T20:00:00Z
    

    but when I specify too old timestamp (more than 3 months in my case), the Graph API returns error message

    Resync required. Replace any local items with the server's version (including deletes) if you're sure that the service was up to date with your local changes when you last sync'd. Upload any local changes that the server doesn't know about.

    So, the most reliable way is to do a manual date check