Forum Discussion

RobD365's avatar
RobD365
Copper Contributor
Mar 25, 2022

Get the content of pervious file version

Hi All,

 

I'm trying to get the content of the last Major version of a document (so it can be published to another site as a PDF).  So if the document is at version 3.6, I need the content of 3.0 to publish.

 

I'm able to work out the current Major version by looking at the actual version and splitting on the decimal.  If the decimal portion is 0, the current file is published.

 

I then use a "Send HTTP request to SharePoint" with _api/web/getfilebyserverrelativeurl('/sites/SrcSite/@{items('Apply_to_each')?['{FullPath}']}')/versions as the URI

 

The results are then filtered to get the version I'm after.  I've seen posts else where that use the resulting _vti_history/17/SrcSite/File name.docx Uri within a "Get file content using path", however that just returns a 404 error.

 

Any ideas on if/how this might be doable?

 

2 Replies

  • RobD365's avatar
    RobD365
    Copper Contributor

    Unfortunately not so we ended up taking a different path.

    Once the user finishes editing, they submit it (e.g. v2.6) via a workflow for approval, once approved it's published as v3.0 within the library, and that version is converted to PDF, all in the one workflow

  • damianwebber's avatar
    damianwebber
    Copper Contributor

    Were you ever able to solve this? I am trying but I am unable to get the contents of the file as well. It seems like it should be simple...

Resources

OSZAR »