Forum Discussion

Si_Da's avatar
Si_Da
Brass Contributor
Apr 10, 2019
Solved

Error when trying to restore to a previous version on SharePoint

The following POST generates an error saying it's not valid:

 

https://{CompanyName}.sharepoint.com/sites/{SiteName}/_api/web/GetFileByServerRelativeUrl('/sites/{SiteName}/Shared%20Documents/{FilenameAndPath}')/versions/{VersionID}/restoreVersion

 

I've tried putting the Version ID in curly brackets and with/without the preceding forward slash but it still doesn't work.  Is anyone able to advise please?

  • For anyone else reading this, this solution works...

     

    https://{CompanyURLName}.sharepoint.com/sites/{SiteName}/_api/web/GetFileByServerRelativeUrl('/sites/{SiteName}/Shared%20Documents/{FilenameAndPath}')/versions/restoreByLabel(versionlabel='{VersionLabel}')

1 Reply

  • Si_Da's avatar
    Si_Da
    Brass Contributor

    For anyone else reading this, this solution works...

     

    https://{CompanyURLName}.sharepoint.com/sites/{SiteName}/_api/web/GetFileByServerRelativeUrl('/sites/{SiteName}/Shared%20Documents/{FilenameAndPath}')/versions/restoreByLabel(versionlabel='{VersionLabel}')