cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

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

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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Power Apps
Power Apps

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.

View solution in original post

Community Support
Community Support

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Power Apps
Power Apps

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.

View solution in original post

Community Support
Community Support

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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

 

In the meanwhile both workarounds should do.

 

Regards,

 

Alejandro

Frequent Visitor

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.

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

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.
Anonymous
Not applicable

@slittle 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.

 

@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.

Advocate I
Advocate I

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.

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (18,554)