Share via

Issue with DELTA query on list-items not returning 'deleted' items

Vikharankar, Vishakha 25 Reputation points
Nov 10, 2023, 8:48 AM

I'm using the GET /sites/{siteId}/lists/{listId}/items/delta API in Graph Explorer, following the documentation at https://learn.microsoft.com/en-us/graph/api/listitem-delta?view=graph-rest-beta&tabs=http. However, I've noticed that the API isn't returning any records of 'deleted' items, unlike what's shown in the example at https://learn.microsoft.com/en-us/graph/api/listitem-delta?view=graph-rest-beta&tabs=javascript#response-2. I was previously able to get 'deleted' items with this API a few days ago. Has something changed?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,466 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Joel Moser 5 Reputation points
    Jan 2, 2025, 3:29 PM

    I had this exact same problem and finally found a solution. It is a nuance with the difference between the listItem and driveItem APIs. Basically the delta query for the driveItem API gives you the information you need that the listItem delta query is lacking.

    However, there is a caveat to the way that you call the driveItem delta query. The API documentation says that you can do a GET /sites/{siteId}/drive/root/delta to fetch the changes to the driveItems in a given site. But that doesn't seem to always return all of the data you need (or doesn't actually track all of the changes properly). When you call the same drive delta API with GET /drives/{drive-id}/root/delta, it returns all of the information you need for handling deleted data. It returns a deleted state and the relevant parent reference information to ensure you can properly identify that item in your system.

    Here is a link to the documentation for reference: https://learn.microsoft.com/en-us/graph/api/driveitem-delta?view=graph-rest-1.0&tabs=http

    Some other notes that were relevant for my use case:

    • If you need the listItem information (for processing non-deletes) you can always use ?$expand=listItem to get that information.
    • If you don't know the drive-id for your site, just a simple fetch to the GET /sites/{siteId} endpoint with a ?$expand=drive query param will give you the drive information you need to call the drive delta query. You can also use that query param on the sites list query.
    1 person found this answer helpful.
    0 comments No comments

  2. RaytheonXie_MSFT 40,426 Reputation points Microsoft External Staff
    Nov 13, 2023, 5:49 AM

    Hi @Vikharankar, Vishakha,

    When using delta query Microsoft Graph returns as deleted new/updated/deleted items that are not in start-end date range of the initial request.

    Please check if you have this issue in the case. Here is the document for tracking changes

    https://learn.microsoft.com/en-us/graph/delta-query-overview


    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.