How to restore a previous version of a Sharepoint document using Power Automate
- Ajith Madathil
- Jun 8, 2019
- 1 min read
Updated: Apr 1, 2020
A SharePoint Document Library provides a secure place to store files where you and your co-workers can find them easily; work on them together and access them from any device at any time.
Restoring a previous version of a document using Sharepoint
First lets see how we would do this in Sharepoint. We would go to the document library, select the file and then choose ‘Version history’.

Then we would select the correct version to restore to and select Restore. Easy.

Now, how can we do this using only Power Automate?
First, we will use the Sharepoint API to grab a list of the versions of the document.
The URL https://{{yoursharepointsite}}/_api/Web/GetFileByServerRelativePath(decodedurl=’/edu/Portal/Ideas/tips.txt’)/Versions is the one we need to hit.
In this URL, ‘edu’ is my SharePoint site, ‘Portal Ideas’ is the library name and 'tips.txt' is my document.
We use an HTTP request to call this URL.

And then we will use a Parse JSON action to unpack the results.
The easiest way to get the property name that we require is to execute the flow step (Send an Http Request to SharePoint), look at the run history and copy the JSON in to the below step (Parse JSON).
We setup a variable Comment which is taken from the VersionLabel property in the JSON.

Now, to actually restore the document to a previous version we will use SharePoint API again. This time we are calling this URL:
https://{{yoursharepointsite}}/_api/Web/GetFileByServerRelativePath(decodedurl=’/edu/Portal/Ideas/tips.txt’)/Versions/restoreByLabel({{Comment variable from above action}})

Hope this was useful.
where's the json to copy from?
What if I need to restore an item, as opposed to a document? How is the http syntax different?