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

Re: Restore previous document version and delete current on SharePoint 2013

@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
Super User

Re: Restore previous document version and delete current on SharePoint 2013

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!



Super User
Super User

Re: Restore previous document version and delete current on SharePoint 2013

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!



Super User
Super User

Re: Restore previous document version and delete current on SharePoint 2013

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!



Anonymous
Not applicable

Re: Restore previous document version and delete current on SharePoint 2013

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

Re: Restore previous document version and delete current on SharePoint 2013

@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
Super User

Re: Restore previous document version and delete current on SharePoint 2013

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!



Anonymous
Not applicable

Re: Restore previous document version and delete current on SharePoint 2013

@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.

Super User
Super User

Re: Restore previous document version and delete current on SharePoint 2013

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!



Re: Restore previous document version and delete current on SharePoint 2013

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

 

Error2.JPG

Highlighted
Super User
Super User

Re: Restore previous document version and delete current on SharePoint 2013

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!



Re: Restore previous document version and delete current on SharePoint 2013

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
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (6,343)