How to grant access to a sharepoint group using Power Automate 'Grant access to an item or a folder' action
-
20-02-2021 - |
Вопрос
I am using 'Grant access to an item or a folder' action to grant access to users at SharePoint list item level.
Now the requirement is to grant access to SharePoint Group as well. How can I pass the group as parameter here in the action to grant access?
Решение
As per the documentation at: Grant access to an item or a folder,
Recipients
has type email and expects the Email address or users or Microsoft 365 groups, etc.
So as per my understanding, you will not able to able to grant access to SharePoint group using this action.
Workaround:
You can use SharePoint REST API in Send an HTTP request to SharePoint
action to grant access to SharePoint group on list item. You need to use below endpoint:
_api/web/lists/getbytitle('<List Name>')/items(<List Item ID>)/roleassignments/addroleassignment(principalid='<Group Principle ID>', roleDefId=<Role Definition ID>)
Example:
Reference: Set SharePoint List Item Permissions Using MS Flow