Power Automate - How to retrieve SharePoint List history?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi in this video we will have a look at SharePoint list version histories here is my SharePoint list called Sports registrations so I have I have enabled the version settings here I created one recorder called cricket and I modified that value as well earlier okay let me delete this and show it again okay click on new I'm going to type here football okay now I'm going to change this edit change football to Cricket okay so how to get the previous value using the version history so if you select this because I enabled the version history I can't see the version history here see first version it was football and the second version It's called Cricket okay yeah so how do we get it so what we need to do here is we can I'm going to use the manual trigger here and using get items the list name is called Sports registrations the next thing I'm going to do here is I'm going to add a compose here and set the version number there it is okay so let me run this so I'm going to call this as retrieve SharePoint list version history okay now I'm going to run my flow now okay float around successfully and let's have a look the version so it should be two here here it is two now so what we need to do next step the next step is I'm going to use a http trigger here so for that I'm going to use send and HTTP request to SharePoint use the same SharePoint name here get and the the URL I am going to use here is slash underscore API slash web slash list slash get by title and the title is called Sports registrations slash items inside the because we want to get each and every item from the list so I'm going to use that ID there get items from the previous step that's the idea I want and then slash I am going to use the versions here versions bracket and use the output of the previous step which is a version number here foreign okay that is the version number so let's see what we are going to get ah here we go see that it doesn't like that it doesn't like the I version 2.0 there because it said the string is not in the correct format okay so the reason here is let me edit this okay so what I did here is I'm going to use just the versions here see that so that means I hope I should get all the versions history related to that first record okay so see because I removed the versions inside the version specific one so this this URL means here this HTTP endpoint slash versions for that item id2 2 is my ID for this record uh that means I'm going to get all the versions so let's have a look so you can see here a couple of things see that there is something called Phi John via see that and then that change to version ID see that one zero two four so there's a versionary below also there then don't do let's have a good look here we go version id512 so version one means internally you know earlier I got there of saying it expect is expecting an integer number so this is a version ID is expecting 512 is the number one so that means if you have let me open and show you that so if you got version one means it's five one two version two means it's times um you know two actually so that's one zero two four and then version 3 means again Phi 1 2 times 3 then so that is one five three six okay right so how to get the previous versions so what we need to do here is instead of passing you know the this version number we need to do a little bit work here so I'm going to add another compost here foreign okay so what I did here is I renamed the current version number that you know the Combos and the previous version number I use this formula here so let me explain this formula then to find the latest the number so as I mentioned earlier it's an incremental of five and two so version one means internally the version ID is five and two for the version version history ID is five one two version two means their internal version history ID is 1024 like that so this is a Formula we need to use here so what we want to do here is we want to subtract then multiplied by the current version number which we need to convert that into int and then multiplying that that means if it version 2 means what will happen here is say 2 times 512 then there's a subtraction here minus Phi 1 2. so that is 1024 minus 512 is equal to Phi 1 2 that's what we are going to get so that's the previous version then so if it's 5 1 15 36 means version 3 so that will be like that 3 times 5 1 2 that is 15 36 minus 512 is equal to 2024. here we go that's the previous version so this is a Formula we need to apply it here so I put that the the calculation here for finding the previous number and it's a compose action step I renamed that to previous version number then the version so finally we can pass this ID here as the previous version number then adding another compost here so add another compost and map the body of that output and I'm going to run the floor now and see what we are going to get all right okay let's see then so the previous version should be 512 remember the current version is 2 that is entirely then it should be 1024. that is the version we are seeing here version two so I'll have a look that here under the version history here here it is see that so what I want is I want this version which I use the formula to find Phi 1 2 it is internally passing that then I should get football instead of qriket I should get the title as football then so let's see what we're going to get if you go that's the previous version then and that's the idea I'm passing there against the item ID then that's the metadata the the output of that so let's see then so that's a version ID if I want to here it is see the title is not Cricket it's the first version it was football actually so this is the way you can retrieve the previous version values then what what the value it was from the version history hope this is useful thanks for watching
Info
Channel: abm abm
Views: 1,043
Rating: undefined out of 5
Keywords: Flow, History, Microsoft, Power Automate, REST API, Send HTTP Request, SharePoint, Version
Id: 5O50FZEGU48
Channel Id: undefined
Length: 10min 10sec (610 seconds)
Published: Wed Sep 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.