cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
adezerega
Level: Power Up

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
PowerApps Staff ashwinsa
PowerApps Staff

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

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 Team
Community Support Team

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

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
PowerApps Staff ashwinsa
PowerApps Staff

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

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 Team
Community Support Team

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

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

adezerega
Level: Power Up

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

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

 

In the meanwhile both workarounds should do.

 

Regards,

 

Alejandro

slittle
Level: Powered On

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

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.
VictoriaH
Level: Powered On

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

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

slittle
Level: Powered On

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

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.
crystalhowat
Level: Powered On

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

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

 

slittle
Level: Powered On

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

@crystalhowatyes, 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
Level: Powered On

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

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users Online
Currently online: 99 members 5,060 guests
Please welcome our newest community members: