Normally adding a folder via drag and drop will include all sub folders and files in the folder as separate changes in the GetChanges response. This doesn't seem to be the case when copying a parent folder in the SharePoint UI. Instead a single change is logged as an add item event. This seems to go against the change log idea with the RecursiveAll set to true.
Have I made a mistake and there's some way this is meant to come across in the getchanges response to avoid having to do a lookup under the single added folder?.
These are my steps
- Upload a folder with child files and folders to SharePoint
- Record latest change token of list after the upload is done
- Copy the parent folder into the same list to create a duplicate
- Call GetChanges for the list using SharePoint Rest API
- Result only displays a single change for adding the parent folder and does not recursively include child items in the folder.
Example GetChanges post call query for step 4 https://mytenant.sharepoint.com/sites/mysite/_api/web/lists/getbytitle('mylist')/getchanges
With payload
{
"query": {
"__metadata": {
"type": "SP.ChangeQuery"
},
"Activity": true,
"Add": true,
"Alert": true,
"ContentType": true,
"DeleteObject": true,
"FetchLimit": "1000",
"Field": true,
"File": true,
"Folder": true,
"Group": true,
"GroupMembershipAdd": true,
"GroupMembershipDelete": true,
"IgnoreStartTokenNotFoundError": false,
"Item": true,
"LatestFirst": false,
"List": false,
"Move": true,
"Navigation": true,
"RecursiveAll": true,
"Rename": true,
"RequireSecurityTrim": false,
"Restore": true,
"RoleAssignmentAdd": true,
"RoleAssignmentDelete": true,
"RoleDefinitionAdd": true,
"RoleDefinitionDelete": true,
"RoleDefinitionUpdate": true,
"SecurityPolicy": true,
"Site": false,
"SystemUpdate": false,
"Update": true,
"User": false,
"View": false,
"Web": false,
"ChangeTokenStart": {
"StringValue": "mylisttoken"
}
}
}
Main payload setting being get item changes and RecursiveAll.
Any ideas?
Related articles https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/query-sharepoint-change-log-with-changequery-and-changetoken