0

I want to restore a version of an item by REST API. I've tried restoring the version in the browser by opening the view below and it did work. The ID of the version which I wanted to restore is "1.0" and I could evoke this version by selecting "restore":

{URL}/_layouts/15/Versions.aspx?list=%7{LIST GUID}%7D&ID={ITEM ID}

However, I want to use the API directory to do it but it does not seem to work:

{URL}/_api/web/lists(guid'{LIST GUID}')/items({ITEM ID})/Versions/restoreByLabel(1.0)

I just receive a message "Cannot find resource for the request Versions". The variation "/File/Versions/restoreByLabel" also does not seem to work. Why is it not possible to access the versions of a particular item through this directory? Is there another way to restore a version through REST API?

2
  • What version of SharePoint are you using, 2013, 2016, 2019, or Online? Commented Mar 1, 2022 at 13:03
  • The version is 2016
    – Jacek
    Commented Mar 1, 2022 at 13:42

1 Answer 1

0

I just did some tests in my SharePoint 2016 VM and it does not appear that the SharePoint 2016 Client Object Model or the REST API support working with list item versions. If you want to restore the item programmatically, you would need to do so using managed code (e.g. C# or VB).

REST API: REST API

Client Object Model: Client Object Model

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.