Skip to main content

Notifications

Community site session details

Community site session details

Session Id : pQDeHi+b0JMopQkSSXwwRZ
Power Automate - Building Flows
Unanswered

How to get Check In Comments of all Versions

Like (0) ShareShare
ReportReport
Posted on 23 Aug 2021 06:07:47 by 4

Hi all,

 

I am very new to power automate, and am trying to create a flow which copies documents to a new library once their status is changed to a certain value. What I'm having trouble with is capturing the Check In Comments for each version. I've gone through this and other forums and found answers similar to those in the links below, however these just give me the same Check In Comment (the last one) against every version of the document (ie, if the last check in comment reads "final test", I'll get "final test" repeated for each version besides the 

"OData__x005f_CheckinComment" value in the outputs of the HTTP request. 
 
I also found people discussing using "getFileByServerRelativeUrl" in the 'Send an HTTP Request to SharePoint" action but I have no idea how to implement that or what the server relative URL is. 
 
If anyone can let me know how to the different Check In Comments for different document versions I would appreciate it!

 

https://powerusers.microsoft.com/t5/Building-Flows/Include-Comment-Version-History-in-email-sent-from-SharePoint/m-p/573335

https://powerusers.microsoft.com/t5/Building-Flows/SharePoint-How-to-get-Check-in-Comment/m-p/355684#M39472

 

  • RobMolenaar Profile Picture
    97 on 27 Nov 2023 at 11:12:03
    Re: How to get Check In Comments of all Versions

    This is exactly what I was looking for thanks!

  • Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 24 Aug 2021 at 07:44:23
    Re: How to get Check In Comments of all Versions

    Hi @jesstaylor90,

     

    The first request is to list all version ids. In the second request (within the apply to each) I am using those ids to retrieve the check-in comment per file version. Via the FileVersion method you should be able to retrieve the individual check-in comment per file version.

     

    I see my screenshot of step 6 was cropped. In the if yes branch I do nothing (in my screenshot it was just a compose). This is because the file version request will be empty for the last file version. Can you remove that append variable 2 action, that action will fail.

     

    And can you also place the FileVersion keyword between double quote characters (i.e. "FileVersion") in your condition action? 

     

  • jesstaylor90 Profile Picture
    4 on 24 Aug 2021 at 00:54:32
    Re: How to get Check In Comments of all Versions

    @Expiscornovus also I've noticed that the first http request does not contain all Check In Comments in the output, which is the same issue I have had before - its just the last comment repeated over and over. 

  • jesstaylor90 Profile Picture
    4 on 24 Aug 2021 at 00:38:27
    Re: How to get Check In Comments of all Versions

    Hi @Expiscornovus Thank you for your reply. I think I'm getting stuck at the 'Apply to each' section. I have tried putting your suggestion into practice with some changes as I kept getting run errors. The flow runs up until the 'Apply to each' and then fails at the 'Append to Array Variable' section, but I looked at the output of the HHTP request above it and it says the following, which makes me think it is failing there:

     

    {
      "d": {
        "FileVersion"null
      }
    }
     
    The URI of the HTTP Requests have been changed to have the folder name and the item ID, as this flow is meant to trigger when a file is modified. I did try with the ListName variable in these, but could not get the flow to move beyond these point until I changed it. Screenshots below:
    Forum1.PNGForum2.PNG
     
  • Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 23 Aug 2021 at 11:53:56
    Re: How to get Check In Comments of all Versions

    Hi @jesstaylor90,

     

    I think part of the solution is in your first link. However, with that approach you can only retrieve the latest check-in comment. If you want to retrieve the other check-in comments you can use the File Version method

     

    With that method you can retrieve the historical check-in comments. 


    Below is an example of that approach. 

     

    1. Create two variables. One string variable for the ListName and one array variable for the CheckInComments

     

    checkincommentsarrayvariable.png

     

    2. Use a Send an HTTP request to SharePoint action to list all versions

     

    getallversions_sendanhttprequest.png

     

    3. Add an apply to Each action. Use the Results property for the select an output from previous steps field. Below is an expression for that.

    outputs('Send_an_HTTP_request_to_SharePoint_-_Get_All_Versions')?['body']['d']['Results']

     

    4. Use another Send an HTTP request to SharePoint action to list all FileVersion properties within the Apply to Each action. In that API call I am using the VersionID field from the previous Send an HTTP request response.

    _api/web/lists/getbytitle('@{variables('ListName')}')/items(1)/versions(@{items('Apply_to_each')?['VersionID']})/FileVersion

     

    getfileversion.png

     

    5. Add a condition within the Apply to Each action. Check if the results contain the property FileVersion

    outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']

     

    6. Add a Append to Array variable action in the If No section of the condition action.
    This check is needed because this API request for the latest version is empty. Otherwise the apply to each loop will error.

     

    Use the following json:

    {
     "Version": @{outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['VersionLabel']},
     "Check-In Comment": @{outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['CheckInComment']}
    }

     

    condition_forarray.png

     

    7. Add a Create HTML Table action outside/after the apply to each action. Use the CheckInCommentsArray in this action.

     

    createhtmltable_checkincomments.png

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard