Skip to content

Sharepoint Rest API - getChanges to get list of deleted files when deleting the parent folder #5964

@4at-nk

Description

@4at-nk

Category

  • Question
  • Typo
  • Additional article idea

Question

I have Document library with folders hierarchy , I'm deleting folder. Inside the folder there about 20 fles, I want to get list of all files (items) that were in the deleted folder. This the request URL :

https://domain.sharepoint.com/sites/TestSite/_api/web/Lists(guid'32d6ed0-51ab-4b4d-ab5b-afdd231f1d2e')/getChanges

And the request body is :

"query": {
    "Add":true,
    "Update":true,
    "Rename":true,
    "Item":true,
    "DeleteObject":true,
    "ChangeTokenStart": {
      "StringValue": "1;3;32d6ed0-51ab-4b4d-ab5b-afdd231f1d2e;637290302157600000;159531544"
    }
  }
}

The response contains only information about folder (ItemID = 32) , but doesn't include any information about deleted files:

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "id": "https://domain.sharepoint.com/sites/TestSite/_api/SP.ChangeItem654725d4-6567-145a-b48c-4eef2a21cd00",
                    "uri": "https://domain.sharepoint.com/sites/TestSite/_api/SP.ChangeItem654725d4-6567-145a-b48c-4eef2a21cd00",
                    "type": "SP.ChangeItem"
                },
                "ChangeToken": {
                    "__metadata": {
                        "type": "SP.ChangeToken"
                    },
                    "StringValue": "1;3;32d6ed0-51ab-4b4d-ab5b-afdd231f1d2e;159531565"
                },
                "ChangeType": 3,
                "SiteId": "xxxx-e0acb7dbeef3",
                "Time": "2020-06-29T12:24:25Z",
                "Editor": "",
                "EditorEmailHint": null,
                "ItemId": 32,
                "ListId": "32d6ed0-51ab-4b4d-ab5b-afdd231f1d2e",
                "ServerRelativeUrl": "",
                "SharedByUser": null,
                "SharedWithUsers": null,
                "UniqueId": "xxx-2fa48d7f9736",
                "WebId": "xxx-5487a53e92d5"
            }
        ]
    }
}

I would expect to get list of deleted items as well, as they're actually deleted. Is there any way to get list of those delete files ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APItype:archive-old-issueIssues which are closed as tool old for active worktype:questionQuestion... if answered, will be tagged as such.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions