web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Access a sharepoint fi...
Power Automate
Unanswered

Access a sharepoint file's *previous* version properties and content

(0) ShareShare
ReportReport
Posted on by 4

Hi.  I've searched here around the internet for days before posting.  First post, be gentle.  I'm struggling with "Get File Properties" and "Get File Content" of a previous version of a file in a sharepoint library.

 

Its pretty easy getting it for my trigger in a Documents library in sharepoint, I just call it from a "For a selected file".  But how can I get the properties and content of a previous file version?

 

I can confirm the file exists, versioning is turned on, I can retrieve the values from a send http request; however since "Get file properties" asks for the file ID (and that file ID on previous versions is the same static integer) - how can I set those?

 

Tried a URI in send an http request to sharepoint but unlike a list, that doesn't seem valid, and even if it returned a value, I'm still stuck having to use the ID in (Get File Properties & Content using the identifier found in the file properties)

Motisko_2-1677093496000.png

 

 

 

I've used logic to find the version I want to access, but just can't seem to nail this URI to get it and even if I did, not sure how to reference the result under Get file properties and then get file content (using the identifier found from the properties).

 

Motisko_3-1677093616003.png

Motisko_4-1677093718876.png

 

 

Thanks in advance for any help.

 

Categories:
I have the same question (0)
  • EugeneM Profile Picture
    4 on at

    So, trying to help myself....  I went into the version history of the files, I hovered over the previous version I'm trying to access and I see a URL:

     

    https://XXXX.com/sites/SiteName/_vti_history/1536/Shared%20Documents/Project%20TRFs/USPS/TSS/FY23/AMD/TRF_AMDMachineLearning_FY23.xlsx 

     

    So I then noticed there is a "Get file content using path" and figured I know the URL - lets just plug it in there and see if it works.  I know using that URL in a browser downloads the file version in question (yay) so it works and I have access and its available BUT... when trying to use this action, it claims it can't find the file.

     

    Motisko_0-1677096484818.png

     

    Motisko_1-1677096629444.png

     

    It it because the action wasn't meant to access that /_vti_history/XXXX/ area before shared documents?

  • wskinnermctc Profile Picture
    6,519 Moderator on at

    FYI: I have poked at this a few times since you originally posted because it is an interesting challenge, but I'm not able to crack it. Mainly because of the address of the version history. I can't tell where they are stored.

     

    Even knowing the address, I think it will take a few HTTP request gymnastics to get what you want. 

  • EugeneM Profile Picture
    4 on at

    Thanks for the response.  This is a great challenge to someone who stands out from the crowd for sure.

     

    I know the URL and how its in a "/_vti/{versionNumber}/Shared Documents....ABC.xlsx" path, I know the URI, I know the version in the history I want to get, I can get the http request, I even got the fie content stored in some type of  base64 that just melted my mind - #frustrated.

     

    I hate myself, but I am proceeding forward to consider just making a "copy" of the file to a temp location when someone submits a file for approval - when they submit it a second time - I automation so I can compare the "current" selected file version, with the previously approved copied version just to compare the list rows against each other.

     

    I feel dirty.  I shouldn't have to copy a file for "later" usage, when I know the current file version I want to access.  I also shouldn't have to consider restoring by label temporarily and then restoring the actual after.

     

    Let me access the previous version's file properties directly!

  • TanyaMc365 Profile Picture
    63 on at

    If you can get the base 64 version then you can use a binary expression to convert the file contents so it's readable. 

     

    Shane young talks about that in this video: https://youtu.be/3QaiM8SeWfM?t=906

     

    If you get it to work please post your full gymnastics routine as I need to do the same! 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard