cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Restore previous document version and delete current on SharePoint 2013

Is there a way to restore the previous document version and delete the current on SharePoint 2013 using the Send an HTTP Request to SharePoint node?

Any help would be appreciated!History Versions.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

@abm 

I can't seem to be able to retrieve the Versions of the document.

When I insert the URL in the browser I am able to successfully obtain something.

works in the browser: https://XXXXX.sharepoint.com/xxxxxx/xxxxxx/_api/Web/GetFileByServerRelativePath(decodedurl='/xxxxxxx...

However, this is not working when running with Send an HTTP Request to SharePoint:Versions 1.png

 

Versions 2.png

 

 

 

SharePoint is able to retrieve https://XXXXX.sharepoint.com/xxxxxxxx/xxxxxx/_api/Web/GetFileByServerRelativePath(decodedurl='/xxxxx...')

so the document is indeed correct and it does exist. I am sure of that.

 

This is what worked for me:

Versions 3.png

 

View solution in original post

11 REPLIES 11
Super User III
Super User III

Hi @Anonymous,

 

I have managed to do this via flow. There are quite a lot of steps to follow here.

 

Once I updated all information I will let you know soon.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Super User III
Super User III

Hi @Anonymous ,

 

Please see my blog post 

 

https://mydevexperience.wordpress.com/2019/06/08/build_msflow_restoredocversion/

 

Any questions please let me know.

 

If you found this useful mark it as accepted solution.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Super User III
Super User III

Hi @Anonymous ,

 

Did you tried the flow steps which I suggested?

 

If you need further help please let me know.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Anonymous
Not applicable

Thank you for your answer @abm.

 

What did you put in the GetFolderByServerRelativePath? Was it the Folder Path? Or maybe the file name with extension?

I tried with both but it didn't work.

FolderPath.png

 

 

 

Anonymous
Not applicable

@abm 

I can't seem to be able to retrieve the Versions of the document.

When I insert the URL in the browser I am able to successfully obtain something.

works in the browser: https://XXXXX.sharepoint.com/xxxxxx/xxxxxx/_api/Web/GetFileByServerRelativePath(decodedurl='/xxxxxxx...

However, this is not working when running with Send an HTTP Request to SharePoint:Versions 1.png

 

Versions 2.png

 

 

 

SharePoint is able to retrieve https://XXXXX.sharepoint.com/xxxxxxxx/xxxxxx/_api/Web/GetFileByServerRelativePath(decodedurl='/xxxxx...')

so the document is indeed correct and it does exist. I am sure of that.

 

This is what worked for me:

Versions 3.png

 

View solution in original post

Super User III
Super User III

Hi @Anonymous ,

 

In your step Send an 'HTTP request to SharePoint7' Uri value don't need the https://xxxx.sharepoint.com/ instead you need _api/Web/..........etc

 

t.png


Please see my blog post for more details

 

https://mydevexperience.wordpress.com/2019/06/08/build_msflow_restoredocversion/

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.


Thanks

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Anonymous
Not applicable

@abm 

Thanks, I must have written that twice by mistake.

 

Anyways, to sum up, this did not work for me:

 _api/Web/GetFileByServerRelativePath(decodedurl='library/document')/Versions/restoreByLabel('VersionLabel')

 

This did:

 _api/web/GetFolderByServerRelativeUrl('library')/Files('document')/Versions/restoreByLabel('VersionLabel')

You could add this as an alternative option to your blog post.

Hi @Anonymous ,

 

Thanks for your update.

 

The difference is we have two different configurations.

 

I have edu is my document library and Portal Ideas is the folder name.

 

Looks like you have no specific folder names. 

 

Glad to hear that it is wokring as expected.

 

Thanks

 

Ajith



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

Im currently working on this as well, when i run the http request the restorebylabel returns null value

 

Error2.JPG

Super User III
Super User III

Hi @karl_oliverio ,

 

Could you please follow this link below & check whether you could restore it manually or not.

 

https://support.office.com/en-us/article/enable-and-configure-versioning-for-a-list-or-library-1555d...

 

Let me know whether you can do the restore manually.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

Hi @abm  - I got it now. When the document version is restored, it will create a new version on top of the current version. I was thinking the old version will just become the current published version. I already checked it and it is working as expected. Thank you!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (8,923)