Restore data from SharePoint version history with PowerAutomate
In this article, we will learn how to use Power Automate and Version History API to restore a document in SharePoint or other cloud storage services. Power Automate is a service that allows you to create automated workflows between different applications and services. Version History API is a RESTful web service that allows you to get and restore the versions of a document in SharePoint or other cloud storage services.
Step 1
Create a flow that triggers when a document is modified or deleted in SharePoint or other cloud storage services. To do this, follow these steps:
Step 2
Add an action to get the version history of the document using the Version History API. To do this, follow these steps:
/_api/web/versions/{versionId} where {versionId}
$(concat('d41d8cd98f00b204e9800998ecf8427e', base64Encode_sha1(triggerBody()?['{versionId}'])))
Step 3
Add an action to restore a specific version of the document using the Version History API. To do this, follow these steps:
领英推荐
/_api/web/versions/{versionId}/restore
$(concat('d41d8cd98f00b204e9800998ecf8427e', base64Encode_sha1(triggerBody()?['{versionId}'])))
Step 4
Add an action to update the document with the restored version using SharePoint or OneDrive actions. To do this, follow these steps:
Step 5
Test your flow and verify that it restores the document to its previous version successfully.
Further Links
You can find some examples of how to use Power Automate and Version History API for restoring documents in SharePoint or other cloud storage services in these link:
Restore a previous version of a ListItem
POST /sites/{site-id}/items/{item-id}/versions/{version-id}/restoreVersion
POST /sites/{site-id}/lists/{list-id}/items/{item-id}/versions/{version-id}/restoreVersion
?