This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.
In this article, we will see a step-by-step implementation of how to break and change list item permission using Power Automate. and for this, we will use REST API.
Create a SharePoint List
Create a Power Automate - We will create an Automated Cloud Flow
1. Go to Power Automate > My flows > Click on New flow > Select Automated Cloud Flow
2. It will ask for the flow name and trigger.
Add flow name and choose a trigger when an item is created.
3. Click on Cerate.
4. Now set Site name and list name in when an item is created in list action.
For all API Calling, we will use Send an HTTP request to SharePoint action.
5. Now we will call REST API to break role inheritance.
Set all properties as below.
|Site Address||Select Site Name from Dropdown|
6. Now we will set new permission so for that we need a user id to whom we have to give permission and need a role definition ID.
User ID: You can directly use User ID if you have or if you have a user name or login name then we have to find user id from the particular user so for that we will call REST API.
Role definition ID: You can use id based on permission.
|Role Definition Name||Role Definition Id|
1. Create a variable and set User Title or if you have any list column then you can use it.
2. Call API to get a user ID and filter it by the above-declared user name.
It will return an object as below,
Now we want to use the only id from this so we will use an expression as below,
And we will set it in a variable called UserId.
3. Now we will set contribute permission for the above UserId.
Now we can test the flow.
We can see contribute permission for an item as below,
In this article, we have seen how to break and change list item permission using power automate.
Hope this helps!
Sharing is caring!