I'm trying to fetch file changes that happens under given folder path in SharePoint document library. I'm using below call
POST https://{domain}/sites/{siteName}/_api/web/lists/getbytitle('Drive')/GetListItemChangesSinceToken
JSON payload to request is
{
"query": {
"ViewName": "",
"QueryOptions": "<QueryOptions><Folder>Drive/Audit Test</Folder></QueryOptions>",
"ChangeToken": "1;3;b39abb17-7a24-4e9a-8a6e-a75b22bffd11;638306253560530000;905277314"
}
}
In response, I get below XML.
<?xml version="1.0" encoding="utf-8" ?><GetListItemChangesSinceTokenResult><listitems MinTimeBetweenSyncs='0' RecommendedTimeBetweenSyncs='180' MaxBulkDocumentSyncSize='500' MaxRecommendedEmbeddedFileSize='500' EffectivePermMask='ViewListItems, OpenItems, ViewVersions, ViewFormPages, Open, ViewPages, ViewUsageData, BrowseUserInfo, UseClientIntegration, UseRemoteAPIs, OpenWebOnly, ViewItemsRequiresOpen' xmlns:s=''
xmlns:dt=''
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<Changes LastChangeToken="1;3;b39abb17-7a24-4e9a-8a6e-a75b22bffd11;638306269242700000;905285618">
<Id ChangeType="Restore" UniqueId="{F856392A-5F48-471F-BD2A-ADECECBD4EF1}">10</Id>
<Id ChangeType="Restore" UniqueId="{F856392A-5F48-471F-BD2A-ADECECBD4EF1}">10</Id>
<Id ChangeType="Rename" UniqueId="{F856392A-5F48-471F-BD2A-ADECECBD4EF1}">10</Id>
<Id ChangeType="Rename" UniqueId="{F856392A-5F48-471F-BD2A-ADECECBD4EF1}">10</Id>
<Id ChangeType="Rename" UniqueId="{3141DD47-B316-472D-9B45-CF1F63E4DE93}">9</Id>
<Id ChangeType="Delete" UniqueId="{F856392A-5F48-471F-BD2A-ADECECBD4EF1}">10</Id>
<Id ChangeType="Delete" UniqueId="{3141DD47-B316-472D-9B45-CF1F63E4DE93}">9</Id>
</Changes>
<rs:data ItemCount="1">
<z:row />
</rs:data>
</listitems></GetListItemChangesSinceTokenResult>
As you can see it returns ChangeType for a file or a folder.
Queries:
- How to get response in JSON, instead of XML format. I did set HTTP request header to Accept: "application/json" but it didn't worked .
- File or Folder Move events
I moved one file from source folder to destination folder. When I check the changes under source folder I saw one rename event and one delete event for that file. see above response for UniqueId="{3141DD47-B316-472D-9B45-CF1F63E4DE93}
.
Isn't there concrete move type. Something like ChangeType="Move"
. Also I want to know source and destination location of moved file or folder. Is this possible?
- Changes only displays file/folder UniqueId and ChangeType. Is it possible to fetch event timestamp as well?