cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RitaAguiar
Level 8

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
RitaAguiar
Level 8

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

 

11 REPLIES 11
abm
Level 10

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

Hi @RitaAguiar,

 

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

 

Highlighted
abm
Level 10

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

Hi @RitaAguiar ,

 

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

abm
Level 10

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

Hi @RitaAguiar ,

 

Did you tried the flow steps which I suggested?

 

If you need further help please let me know.

 

Thanks

RitaAguiar
Level 8

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

 

 

 

RitaAguiar
Level 8

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

 

abm
Level 10

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

Hi @RitaAguiar ,

 

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

 

 

 

RitaAguiar
Level 8

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.

abm
Level 10

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

Hi @RitaAguiar ,

 

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

karl_oliverio
Level: Powered On

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

abm
Level 10

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

karl_oliverio
Level: Powered On

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

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

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

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 55 members 4,293 guests
Please welcome our newest community members: