I am using SharePoint rest API/getchanges to get changes in a SharePoint site and obtain results as :-

    "d": {
        "results": [{
            "__metadata": {
                "id": "https://mysite.sharepoint.com/test/_api/SP.ChangeItem38931e4b-01fa-4744-b478-e4f2b7cd7d8c",
                "uri": "https://mysite.sharepoint.com/test/_api/SP.ChangeItem38931e4b-01fa-4744-b478-e4f2b7cd7d8c",
                "type": "SP.ChangeItem"
            "ChangeToken": {
                "__metadata": {
                    "type": "SP.ChangeToken"
                "StringValue": "1;1;16393f71-acfe-4ff4-a8e2-5668f572d3c6;636035775676900000;17124328"
            "ChangeType": 1,
            "SiteId": "16393f71-acfe-4ff4-a8e2-5668f572d3c6",
            "Time": "2016-07-08T12:26:07Z",
            "Editor": "",
            "EditorEmailHint": null,
            "ItemId": 21,
            "ListId": "244dcdb3-d056-4184-aa21-1dc7f507f199",
            "ServerRelativeUrl": "",
            "SharedByUser": null,
            "SharedWithUsers": null,
            "WebId": "9eb4d645-db81-4e3b-b2c1-cecc0b4efe5f"

The request I've used is :-

POST http://mysite.sharepoint.com/test/_api/site/getchanges with json body as change query :-

  'query': {
    '__metadata': {
      'type': 'SP.ChangeQuery'
    'Update': true, 'Add': true,'Item':true,'DeleteObject':true

Now I would like to get the contents out of these changes if it is a file change. But I cannot relate the Id obtained in the result WebId or ItemId to the file id that can be obtained using files and folders api of sharepoint. So how can I relate this result to the actual file id or file to get the contents of changed file?

1 Answer 1


From further research I found out that we can get the file contents by calling :-

GET https://mysite.sharepoint.com/<site_name>/_api/web/lists(guid'<list-id>')/items(<item-id>)/File 

api of sharepoint using list id and item id obtained from /getchanges api. Then use the ServerRelativeUrl field of response to obtain file contents by calling :-

GET http://mysite.sharepoint.com/<site_name>/_api/web/getfilebyserverrelativeurl('<url>)/$value?binaryStringResponseBody=true

Cheers :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.