Power Automate Get Sharepoint Site Users

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so we're going to do a power automate get sharepoint site users we're going to start off creating a flow then we're going to get users from sharepoint site and after that we're going to filter out the trash entries that we retrieve back from sharepoint so going here to power automate we're going to hit create to create a new flow then we're going to select instant cloudflow so we can run here manually we're going to call this get users from sharepoint site select manually manually trigger flow um after that so we can run manually right this is our trigger action so the next thing we're going to do is we're going to click on new step and we're going to do the send http right so we can call sharepoint api send http request to sharepoint after that we select the site you want to retrieve the users from so just click on the arrow here on the right side select the site or you can enter custom value and you can copy and paste the url if you did not find it so just so i'm going to select here the test site it's going to be a get method and i have here a writing github the code for that right so if i hit code get sharepoint site users here is the code so i can just copy this so this is the code to do the api request okay so you can just paste it here and we can just put compose for now to see if it's working what we're getting back right and the github so i'm just selecting here the body from what we're retrieving back from saying http requests putting that inside the composer you can see it hitting save and we're gonna run test just so you know uh on the description i'll post to github so you also have this available for you so let's hit test manually test continue run flow done okay if we look here inside the compose inside the results we have some data structure here it's kind of hard to see without putting inside something like a notepad so just put here so you'll see it uh and here we have the results then we have array structure right that we want so we see a couple of them have a null value right for user principle name we're going to clean that out as part of the cleanup process a couple of them in null but a couple of them do have the value right where we do have the user itself so here we have one user and then we have another mole right another one that's trash that we want some of the null this is another user so user principal name is usually a good way to filter out the ones you really need so this is test one for example right so now uh what we're going to do is we're going to basically just put this within a queen structure that we really want um so first thing i'm going to do is i'm going to add an action i'm going to put select so we put into a better uh structure that we want right so from uh we're gonna use certainly the send http request right um you certainly use that body there but the by itself does not have the array structure uh is within the results all right so what i'm going to do is i'm going to rename this so it's easier for us to use this as a variable and put let's say get users okay and then here we have to put an expression uh that iterates to this structure here right so to iterate to this we need to go into the results right this is the where we can iterate through the to the json so i already put here also on github you can just copy and paste which is body and the results that's basically the data structure that we can iterate through the data so it copied i'm going to paste that and set expression just going to hit ok and to map here out we're going to put user principal name and here for each one we just put an item [Applause] and then we put the value that we want within each structure there so within each structure we have all this data including user principal name that's we're going to use today if you have email uh you can just use email yourself i'm going to use user principal name is what i have here and then i can just clean this out and put from whatever the output is from the select here in the compose so we can debug and see what's going on so now i can hit test i'm going to do a manual run run full okay so now we have the cleaned up structure for what we want i see user principal name here right so a couple of them are no all right so i don't want these nulls for sure i just want the ones that have the values that i want right which is test one test two and remove right so let's just hit edit uh how do we filter these out right so we have another nice little uh action that we can use just type in filter it's called filter array from data operation so here what we're going to use is we're going to use the previous value from select right because we clean this up and we want to do a filter based upon uh based upon the item right so item username so let's just copy this right so we're going to use expression item username is not equal to null all right so null we have to click on the box expression and then type in null otherwise it's uh power automate thinks is a null as a string so we have to put this with an expression so we know it's null and then here on the output we just clean it up and we just put whatever is the output from the filter array so i hit save and after hitting save i can just hit test and perform manual run run the flow okay she decides to not show up so this happens you can just go back to previous let's just click on the last execution it's going to show up there for us and now the null values have gone away so now with this right structure you can do whatever you want right you can send emails or put inside sharepoint lists it's up to you on what you want to do with this information i hope you enjoyed the learning and have fun there with your hacking there getting users from sharepoint sites
Info
Channel: Ramon Lima
Views: 7,767
Rating: undefined out of 5
Keywords: microsoft 365, microsoft sharepoint, office 365, power automate, power platform, sharepoint online, sharepoint permissions, sharepoint tutorial
Id: GGP_vcfp04s
Channel Id: undefined
Length: 9min 8sec (548 seconds)
Published: Mon Mar 28 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.