Update SharePoint Document Permissions using Power Automate

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is druveen and in this session we are going to talk about how we can update sharepoint document permission using microsoft flow or power automate so now let's get started [Music] now first of all let me explain you the business requirement this is my sharepoint site and i am creating one news post over here now what happen here is whenever i create any news post it will automatically create one site page in my site now what happen here is here you can see in the page details we have different types of category now let's say from category if i'm selecting it what happen here is it should automatically remove all visitor groups permission from that specific page so this is the page that is created over here and if we go to the site page and check out like what is the permission over there by manage access what we can see is we can see that leave application visitors group is added here they have the view permission now what i want to do here is i just want to remove that specific groups permission when the category is id this type of requirement i want to achieve now second thing so whenever i'm uploading any document to my document library they are not a visitor group are not able to access or view that particular document so basically in short i want to remove all visitors permission whenever a new document is uploaded to my sharepoint document library or site pages so how can i achieve this requirement this is simple straightforward and easily achievable with the help of power automate or microsoft flow now let me explain you how to do that in order to achieve that we need to create one microsoft flow over there first of all create a flow when a file is created or modified in a folder so first of all we need to take this action right select the site address and folder so basically i want to trigger this flow whenever in leave application site a new page is created to the site pages so you just need to select site pages as a folder id here now whenever you click on this folder icon you will be able to see all the available folders for your site you can set any site based on your requirement so at this moment i have set site pages over here now i need to use an action get file metadata so just click on plus icon add an action and search here for get file metadata so you will be able to see this action get file metadata over here just add that action now once you add that action it will ask two things to you site address and file identifier insight address provide the site name and in file identifier whenever you click on that you will be seeing that this is the file identifier x dash ms-file dash id right just add that particular field over here right now after that i also need the page properties as well in order to do that i need to add an action get file properties over here so just add an action and just add get file properties over here get file properties right so here is the action get file properties right now whenever you add that particular property it will ask site address your library name and id right so site address and library name we all are aware because i want to trigger this on site pages and i need the item id right so just click on here and uh you will be getting item id from this metadata action so you just need to select item id from here and add it to here right now i want to check a condition like if my category is i t then in then i want to remove that permission right now in order to do that what we need to do here is we need to add a condition like if category is equal to i t then what we need to do here is we need to add one rest api call over here now what is that rest api call let me explain you that thing and let me explain you how to add that rest api call right now we need to call one sharepoint rest api for that click on add an action now here search for send an http request to sharepoint so what happen here is when you add that it will add this type of interface for you where you need to provide the site address method uri headers and body part right now let me explain you for this particular thing which api do we need to use so let me show you that thing in detail first of all we need to select the site address for method select post call now in uri we need to use this particular api over here slash api wave list and inside that you need to provide the list id over here then slash get item by id we need to provide the item id and we need to use api update document sharing information right now don't worry i am providing this code on my github account links are always down below in the description box you can directly download that entire flow from there and get all the information over there here you just need to make one change for this particular update document sharing information api basically you need to provide the list id in order to find the list id go to the site pages and go to the setting and go to the library setting and now here you can find the entire list id over here just copy that id and paste it into your power automatic flow and item id is something which is already we found from the get item get file metadata action so using this metadata we are also having the item id so we just need to pass that item id over here right now in headers you need to pass content type application json or or data verbose right you just need to add this line over here in the headers now now in body part we need to add one json structure now let me explain that json structure in detail over here here we need to pass this type of json structure as a part of body in our api now let me explain you different parameter of it the first parameter is user role assignments here we need to pass user id and role now user id is the name of your group so my group name is leave application visitors so i need to pass that now roll there are four types of roll you can assign here if you want to stop or remove the permission you need to use zero right if you want to provide view permission you need to pass one for edit you need to pass to and for owner permission you need to pass three so based on your requirement you can pass any role permission over here right now the second parameter is validate existing permissions this particular parameter is also dependent on additive mode as well now let's say if we set validate existing permission as true what happened here is it will not granting the permission if user has already a permission assigned and now if it is set as false meaning that it doesn't matter like user has assigned the permission or not it will replace that permission then editing mode additive made is either false or true now let's say if it has been set as true meaning that if the permission has already been provided it will just ignore that and if it is set as false meaning that specified permission will replace current user's permission right then send server manager notification so if you want to send user notification about the updation of the role you can set it true custom message you can set and these are other two properties which we need to set as like this right so this is the overall json structure idea now let's just copy this entire json structure and paste it to our body part now let's just paste our copied code over here and you can see that this is the code that we have written to remove the leave application visitors permission whenever a site page with id category has been created right now let's save the flow and let's test the flow over here so i just saved this particular flow over here now let's test the flow so now let me just create one news post over here so that will create one side page so let me create one blank page over here so i just created the blank page just let me provide the name of my page the page name that i am providing here is learn to all right now what i want to do here is i just want to set category so i am setting my category as i t from here so i'm just said that and now let me just post this particular news so what it will do is it will create one side page over here so here we can see that one side page he's been created here and now let's check its manage access so you can see that visitor group has viewer permission over here right now let's say what i want to do here is i want to remove this permission right so our flow has already been triggered and let's check the run of the flow over here and here it is the floor ran successfully let's check the flooring so here you can see that it has been triggered when the file has been created it captures the file metadata over here get file properties will provide the item id and all of that information it goes to the true condition because page category is id and now it just send the http call and as a result we are getting the success and now let's check the configuration property of the page and let's check the permission level let me hit refresh over here and let's check if the permission has been removed or not so we have created a page learn to all so let me just click on here and check on manage permission right so here you can see that visitor permission group has been removed from here now let me talk about one more requirement let's say for an example i want to achieve a requirement like whenever a new document is uploaded to my document library what it will happen here is its visitor group should have the edit permission on that right so how can i achieve that requirement right so for that i have created the similar flow when a file is created or modified in a folder here we just need to provide the document library path then we are just getting the file metadata and file properties over here as the previous flow and then we are going to use the same http call over here same call only the list id and item id will be changed rest of the information are as it is now here i just made one later variation over here and what is that variation here i just pass roll value as 2 2 means editor because i want to provide visitor as edit permission over here right so that's why i just added role as to right now let's test this particular flow over here so let me upload any appropriate document over here into my document library so i am uploading one image file over here so what happened here is uh it the file has been added successfully here and now let's check its permission so whenever i'm going to manage access at this moment you can see that visitor has only view permission right a can view permission right now what i want to do here is we need to update that to edit permission so let's check the floor end and let's check the outcome and here it is the floor ran successful let's check the floor and here and it triggers the http call and we are getting the successful outcome here now let's check the permission again let me hit refresh on my document library and now let's check the picture one's permission so let's check manage access and here you can see that visitor group has now added permission over here right so this is how you can remove the permission or you can update the existing permission using this particular api hope this is clear for you now if you have any question related to this topic you can add your questions in the comment section also if you want to have any other suggestion for my video or improvements area you can add your suggestion in the comment section i would happy to improvise myself one more thing if you want me to prepare any other power platform video or specific series you can add your request in the comment section from there i will pick up my upcoming videos topic and prepare the new video for you if you are for the first time to my channel make sure you hit subscribe and press the bell notification to never miss any updates from my channel stay tuned with me on facebook linkedin twitter and whatsapp if you wish to receive daily notification on your whatsapp number click on this link it will be redirecting you to this form fill the form and you will be receiving daily notification on your whatsapp number stay connected with me have a great day goodbye
Info
Channel: Dhruvin Shah
Views: 1,334
Rating: 5 out of 5
Keywords: Update SharePoint Document Library Permission Using Flow, Update Site Pages Permission using Microsoft Flow, UpdateDocumentSharingInfo API using Flow, Power Automate to Update Document Permissions, Update Permissions using Microsoft Flow in SharePoint, Remove Specific Group Permission from Site Pages using Flow, Permissions Management using SharePoint and Flow, UpdateDocumentSharingInfo Power Automate, Microsoft Flow, Power Automate, Power Platform, Flow with Dhruvin shah
Id: zFFlmLqzkw4
Channel Id: undefined
Length: 13min 45sec (825 seconds)
Published: Thu Sep 24 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.