cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tho1971
Frequent Visitor

Download file content of all item versions (history) in a SharePoint document library

Hi

I created a flow to go through all versions of a sharepoint item in a document library. I can get the VersionLabel and VersionId but I'm not able to get the file content of each version. Is there a way to do that in power automate?

Below is my flow. It works except the last step to get the version file content. 

tho1971_0-1607507799407.png

Cheers Harald.

1 ACCEPTED SOLUTION

Accepted Solutions
Mohammad3Amer
New Member

To be able to get the file content of each version, you could use (Get Request) with (Send an HTTP request to SharePoint)

 

Site Address: yourSiteAddress

Type: Get
Sample Uri: _api/web/getfilebyserverrelativeurl('/sites/xyz/Description.docx')/versions


You will get results that contains Urls for all versions of this file like the sample below

{
"d": {
"results": [
{
"__metadata": {
"id": "https://xyz.sharepoint.com/sites/SiteName/_api/SP.FileVersionGuid",
"uri": "https://xyz.sharepoint.com/sites/SiteName/_api/SP.FileVersionGuid",
"type": "SP.FileVersion"
},
"CreatedBy": {
"__deferred": {
"uri": "https://xyz.sharepoint.com/sites/SiteName/_api/SP.FileVersionGuid/CreatedBy"
}
},
"CheckInComment": "",
"Created": "2020-01-18T14:28:21Z",
"ID": 512,
"IsCurrentVersion": false,
"Length": "543967",
"Size": 543967,
"Url": "_vti_history/512/Shared Documents/xyz/Description.docx",
"VersionLabel": "1.0"
},
{
...
...
}
]
}
}

 

 

Try to reuse this URL ""Url": "_vti_history/512/Shared Documents/xyz/Description.docx" to download file versions

View solution in original post

6 REPLIES 6
Mohammad3Amer
New Member

To be able to get the file content of each version, you could use (Get Request) with (Send an HTTP request to SharePoint)

 

Site Address: yourSiteAddress

Type: Get
Sample Uri: _api/web/getfilebyserverrelativeurl('/sites/xyz/Description.docx')/versions


You will get results that contains Urls for all versions of this file like the sample below

{
"d": {
"results": [
{
"__metadata": {
"id": "https://xyz.sharepoint.com/sites/SiteName/_api/SP.FileVersionGuid",
"uri": "https://xyz.sharepoint.com/sites/SiteName/_api/SP.FileVersionGuid",
"type": "SP.FileVersion"
},
"CreatedBy": {
"__deferred": {
"uri": "https://xyz.sharepoint.com/sites/SiteName/_api/SP.FileVersionGuid/CreatedBy"
}
},
"CheckInComment": "",
"Created": "2020-01-18T14:28:21Z",
"ID": 512,
"IsCurrentVersion": false,
"Length": "543967",
"Size": 543967,
"Url": "_vti_history/512/Shared Documents/xyz/Description.docx",
"VersionLabel": "1.0"
},
{
...
...
}
]
}
}

 

 

Try to reuse this URL ""Url": "_vti_history/512/Shared Documents/xyz/Description.docx" to download file versions

Hi,

i am able to get the URL": "_vti_history/512/Shared Documents/xyz/Description.docx" . how can i copy/move the file using power automate with that url?

Hi

You can use the action "Get file content using path" to get the file content and save it wherever you want.

 

Hi
Thank you for your reply. Unfortunately it doesnt work. file not found for file version history with link "_vti_history/512/Shared Documents/xyz/xxx.docx"

pityman_0-1632732689122.png

 

sfreitas
Helper I
Helper I

I've the same issue. 


Anyone have a solution for this issue? 


When I use the link in browser I can see the right document, but in Power Automate I have always an error " File not found".

mrniklass
Regular Visitor

Has someone solved this one? I have the _vti_history/512/Shared Documents/xyz/xxx.docx URL but I cannot figure out how to download the file.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,894)