Changes returned when folder deleted using ChangeQuery and GetChanges in CSOM


Have a folder in a SharePoint Document Library that has 3 files in it.


When I delete the folder, I'm getting one change returned in the GetChanges function. It is a ChangeItem related to the deleted folder, but I don't get any changes returned for the files in the folder.


Is this correct?

I'm sure in the past I used to get the files that have been deleted too, but unable to confirm.


This is the code I'm using currently.


Have tried at different scopes to (i.e. changes at Library, Root Folder etc.)


using (var authenticationManager = new AuthenticationManager())
using (var context = authenticationManager.GetContext(siteUri))
                var site = context.Site;
                var query = new ChangeQuery(true, true)
                    File = true,
                    Item = true,
                    Folder = true,
                    RecursiveAll = true,
                    DeleteObject = true,
                    Rename = false,
                    Add = false,
                    Update = false,
                    Site = false,
                    Web = false,
                    List = false,
                    User = false,
                    View = false,
                    SystemUpdate = false,
                var changes = site.GetChanges(query);
                await context.ExecuteQueryAsync();

                foreach (Change change in changes)
                    if (change is Microsoft.SharePoint.Client.ChangeItem)
                        ChangeItem ci = change as ChangeItem;
                        Console.WriteLine($"Item {ci.ItemId.ToString()}: {ci.ChangeType.ToString()}");

                    if (change is Microsoft.SharePoint.Client.ChangeFolder)
                        ChangeFolder cf = change as ChangeFolder;
                        Console.WriteLine($"Folder {cf.UniqueId.ToString()}: {cf.ChangeType.ToString()}");

                    if (change is Microsoft.SharePoint.Client.ChangeFile)
                        ChangeFile cf = change as ChangeFile;
                        Console.WriteLine($"Folder {cf.UniqueId.ToString()}: {cf.ChangeType.ToString()}");


0 Replies