Hi Md Sadiq Imam, Thank you for reaching out on Microsoft Q&A! I've addressed the kinda the same issue before in another topic, which was around specific items. However, if you remove the /items({itemId}) from the URL's you could do the exact same for the library itself. Below I've changed the URL's, so please don't pay attention to the URL's in the screenshots but use the URL's noted below them.
This can be achieved by the "Send an HTTP request to SharePoint" indeed, as there are no default actions available within the SharePoint Connector as of yet. Basically, to execute your desired process its three steps to be performed in order:
- First you need to reset role inheritance, where you reset all custom permissions sets back to it's inherited state:
URL:
_api/lists/getById('{listId}')/resetroleinheritance
- Next you need to break role inheritance, as this is reset by the previous action where you made sure the rights were the same. This can be done as follows:
**
URL:**
_api/lists/getById('{listId}')/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=true)
**
Note:** the "copyRoleAssignments=false" makes sure the current roles set will not be copied to the folder and all subsequent files. This basically clears all permissions. With "clearSubscopes=true" you make sure all subsequent files will follow the new permission set from the parent
- After that you can add new user ID's with their respective permissions back to the folder. Please find the table below for the default role assignments and their ID's. You do this with the step below:
URL:
_api/web/lists/getById('{listId}')/roleassignments/addroleassignment(principalid={userId},roledefid={roleDefinitionId})
Please be sure to update {listId}, {userId} and {roleDefinitionId} to the respective ID's from your flow to match your situation. For the role definitions, at least the defaulf ones, you can use the table below:
||
||
|Full Control|1073741829|
|Design|1073741828|
|Edit|1073741830|
|Contribute|1073741827|
|Read|1073741826|
|View Only|1073741924|
|Limited Access|1073741825|
Please click “Accept answer” if you find this helpful. Feel free to drop additional queries in the comments below! Kind regards, Sonny