Sharepoint CSOM Change Log query is not displaying item deleted logs

2022-04-04T14:32:36.757+00:00

Hi, I want to get deleted items/files from a SharePoint list using the change query logs.

Below is the code snippet I have tried to get the logs.

The changequery returns items/files that are added or updated but not deleted.

Can somebody help me on this where am I going wrong?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,624 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,668 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 31,071 Reputation points Microsoft Vendor
    2022-04-05T08:42:45.19+00:00

    Hi @Sonith Chebathini (LARSEN & TOUBRO INFOTECH LIMIT) ,
    We can refer to following code to get deleted logs

    foreach (Change change in changes)  
    {  
      if (change is Microsoft.SharePoint.Client.ChangeItem)  
      {  
        ChangeItem ci = change as ChangeItem;  
        changeType = ci.ChangeType.ToString();  
        itemId = ci.ItemId.ToString();  
        Console.WriteLine("{0}: {1}", itemId, changeType);  
      }  
    }  
    

    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.