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 / How to get previous ve...
Power Automate
Unanswered

How to get previous versions of a list items from Sharepoint Connector

(0) ShareShare
ReportReport
Posted on by 8

I have a sharepoint list set up as a helpdesk, where the agents input the actions performed in a comments field which has versions. Everytime the agent writes a comment and saves, sharepoint creates a new version of the list item. In the view form, sharepoint shows the previous entries.

 

Does anybody know how to get those previous entries from the Sharepoint connector in Microsoft Flow? When the helpdesk ticket is closed, I want to send the requestor a summary of all the actions performed, but with the dynamic content, only the latest version of the field is shown. 

 

All help is appreciated.

 

Regards

Alejandro

Categories:
I have the same question (0)
  • Verified answer
    ashwinsa Profile Picture
    on at

    Hi @adezerega, currently the sharepoint connector gets the latest information of the list items. As a workaround, i recommend saving the information elsewhere to display the timline that you want to achieve.

    @KeremY to see if there are any other ideas on the retrieving previous entires.

  • Verified answer
    v-micsh-msft Profile Picture
    on at

    Hi @adezerega,

     

    As Staff ashwinsa shared, currently it is only available for Microsoft Flow to get the latest information of the Append comments, there is no way to get the History directly under Microsoft Flow.

    A workaround here is to export the Version History into an Excel file, then use Flow Excel connector to get the corresponding data:

    How to export version history of SharePoint list items using Powershell (A script)

    Further, if you would like this feature to be supported under Microsoft Flow, please consider submit this as an idea, under the Flow idea forum:

    https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

    Regards,

    Michael

  • adezerega Profile Picture
    8 on at

    Thanks very much for the reply. I will add this issue as a feature request.

     

    In the meanwhile both workarounds should do.

     

    Regards,

     

    Alejandro

  • Community Power Platform Member Profile Picture
    on at
    You can't get version history directly, but you can query the SharePoint API and pull it that way. I've done it. I can lay out more detailed steps if anyone's interested.
  • Community Power Platform Member Profile Picture
    on at

    @Anonymous - I'm VERY interested if the offer still stands! 🙂 

  • Community Power Platform Member Profile Picture
    on at

    I'm so sorry, I keep telling myself I'm going to do this not on company time and I keep forgetting. 

    So the most applicable part, simply getting the version history, is pretty straightforward. You just use a 'Send HTTP Request to SharePoint' action.

    version history 1.PNG

    Now you can open the links you get from that and see all the version history information. And then you just have to write the code that fetches the piece of information you need.

     

    What I wanted was to get the version number.

    So, a 'Parse JSON' action:

    version history 2.PNG

    The schema is

    {
    "type": "object",
    "properties": {
    "d": {
    "type": "object",
    "properties": {
    "results": {
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
    "IsCurrentVersion": {
    "type": "boolean"
    },
    "VersionId": {
    "type": "integer"
    },
    "VersionLabel": {
    "type": "string"
    }
    },
    "required": [
    "IsCurrentVersion",
    "VersionId",
    "VersionLabel",
    "Title"
    ]
    }
    }
    }
    }
    }
    }
     
    This gives you the same output as you had before, but now it's selectable as dynamic content.
    version history 3.PNG
    Now use the first() function to pull the top result from the array, which will always be the most recent version. This is an 'Initialize Variable' action, but 'Compose' would probably work too.
    first(body('Parse_JSON')?['d']?['results'])
    version history 4.PNG
    Another 'Parse JSON' to get selectable dynamic content out of the version.
    Schema:
    {
    "type": "object",
    "properties": {
    "Created": {
    "type": "string"
    },
    "IsCurrentVersion": {
    "type": "boolean"
    },
    "VersionId": {
    "type": "integer"
    },
    "VersionLabel": {
    "type": "string"
    }
    }
    }
    version history 5.PNG
    Then the VersionLabel property is what you're looking for. In my case, I typed it to Integer.
    int(body('Parse_JSON_2')?['VersionLabel'])
     
    Sorry again this is so late! Hope it's still useful.
  • Community Power Platform Member Profile Picture
    on at

    @Anonymous Is the last step an 'Initialize Variable' action also? 

     

    Do you know how I would go about comparing two versions for a list item and if there is a change in a field, sending notification?

     

     


    version history 5.PNG
    Then the VersionLabel property is what you're looking for. In my case, I typed it to Integer.
    int(body('Parse_JSON_2')?['VersionLabel'])
     
    Sorry again this is so late! Hope it's still useful.

     

  • Community Power Platform Member Profile Picture
    on at

    @Anonymousyes, that is an Initialize Variable step.


     

    Do you know how I would go about comparing two versions for a list item and if there is a change in a field, sending notification?



    The easiest way by far to do that is to set up the alert in SharePoint itself. Is there a reason you can't do that? I'd have to dive into the process pretty deeply.

  • Haggishk Profile Picture
    11 on at

    There is quite alot of good stuff here, but very complicated on the coding side.  I have found this -

     

    https://www.about365.nl/2019/08/08/view-sharepoint-item-version-history-in-powerapps/

     

    which is brilliant when i ncorporating with powerapps, however, i am sure it can be integrated with any flow trigger.  much more simple and returns data to powerapps in a usable format.

     

    Using notepad it is possible to look into the elements of each version to get the proper coding for each string item you want to pull in for each version.  The trick moving forward would be to be able to clean up the returned data to only show the changed items to properly show the version changes like the version history frame shows on the list itself.

     

    Hope someone will delve deeper into this and see what comes out.

  • JohnColvin Profile Picture
    64 on at

    I have tried your method but I also need to use Power Automate to RESTORE the previous version. I've tried:

     

    _api/web/lists/GetByTitle('CPA%20List')/items(1817)/versions(14)/RestoreVersion

     

    ...but I end up with a 404 Not Found. I've also tried another method "RestoreByLabel" and have been unable to get that to work either...

     

    Any suggestions?

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