Forum Discussion
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_DaBrass 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}')