Yunus Emre
Software Engineer
View Sharepoint Version History - Power Automate
All changes made to Sharepoint libraries or lists are saved as version history. In this article, sharepoint version history with power automate and how to display this information in the powerapps interface.
Sharepoint Version History
We are going to view sharepoint version histories with power automate. For this we need a site, a list inside the site, a row inside the list.
I want my flow to run not automatically but when triggered from the application with powerapps(v2). In other words, there is a button that triggers the flow I created in the application.
We want 3 pieces of data from the Powerapps application. These are the link to the site, the name of the list and the ID number of the relevant row.
Then we create a string variable.
After the variable definition process, Sharepoint We retrieve the versions of the related data via HTTP. This process will return data to us. We will parse the returned data. At this stage, we run the flow once and see what kind of data this process returns from the flow history. Because we will use this data in the parsing process.
I parsed the data returned from the version with Json parsing. I did not write the schema field. (It can also be written manually) I clicked the "Generate from sample" button to create the schema field and pasted the data returned from http on the screen that appeared. In this way, power automate automatically created the schema field.
In the next step, we assign data to the string variable named "MessageBody" that I created before. In my list there is a column named "ornek". With this process, we pull the change in the ornek column, the date of the change and who made the change. These variables come to us in the json field we parsed.
Finally, we send the string variable named "MessageBody" to our application. We can get this data by writing the following code in the onclick field of the Powerapps button.
Set(GelenVeri,VersionHistory.Run("https://tenant.sharepoint.com/sites/mryed","person",1).veriler)
Note: If your computer language is Turkish, you must use ";" instead of ",".
Now we have a variable called "IncomingData" in the powerapps interface. This variable will give us the versions of the data number 1 in the person list on the mryed site.
You can change the flow according to your wishes. For example, you can not get the link and list name in this way and just ask powerapps for an ID number.
This is the Sharepoint version history viewing process in a nutshell. See you in the next article...
1 Comment