“Can I use Power Automate flow to add user to a SharePoint group? All the actions I see are related only to M365 groups…”
The new way to manage permissions in SharePoint is to use Microsoft 365 groups, which is why Power Automate has dedicated actions for that. But not every organisation transferred to M365 groups. Many SharePoint sites still use SharePoint groups for permissions management, and you might need to stick to that approach for some time. Yet Power Automate doesn’t give you any action to add permissions to a group, or to add new members to such group.
Adding permissions already has a dedicated blog post, this one will show you how to add members to such group.
Add the members with an HTTP request
Since there’s no dedicated action, you must use an HTTP request. You’ll need two inputs – group id and the user email:
Method: POST
Uri:
_api/web/siteGroups/GetById(<groupId>)/users
Headers:
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
}
Body:
{
"__metadata": {
"type": "SP.User"
},
"LoginName": "i:0#.f|membership|<userEmail>"
}
Note: <…> are placeholders, replace them including the < and >.
Summary
It is possible to add user to a SharePoint group in Power Automate flow, but you’ll need another HTTP request. Get the group id, the user claims login, and add him with the ‘Send an HTTP request to SharePoint’ action.
Tom ,
Thanks a lot for this article. All works perfect.
Have question:
Can I use Power Automate flow from one SharePoint to add user to a SharePoint group in another SharePoint
Hello Dmitry,
yes, you can, you just have to enter URL of the other SP site in the HTTP request.
Hi Tom! I have a question:
Is it possible to turn someone who is a member into an owner or an owner into a member using this HTTP request?
Hello Matheus,) that might work to add owner to a group. I didn’t find any request to remove a user, but maybe it’ll remove the owner if you use DELETE request instead of POST.
quick search via google gave me this http request: /_api/web/sitegroups/getByName(‘GroupName’)/SetUserAsOwner(
Hi. I am very new to power apps and trying your solution. any idea what this means?
The property ‘__metadata’ does not exist on type ‘SP.User’. Make sure to only use property names that are defined by the type.
Hello Dorothy,
I’d check the quotes, if they’re done using the right character and not some local version of quotes. And then the format of the request, if it’s really 1:1 with the example.
Hi Tom,
I need a quick help / guidance/ suggestion for a scenario:
I need to add users which are present in people picker column (multi select), and there are 2-3 columns, so I need to get all those users and add them a SharePoint group, all these using power automate flow. I found your this article helpful, but it is for single user and hard coded value. Hope you got my question, I will wait for your response. Thanks in advance ! 🙂
Hello Oodit,
the simplest approach would be to repeat the http request for each column. Loop through the users in the 1st column and for each user send an http request using his email address. Then 2nd loop with http request to add users from the 2nd column and the same for the 3rd column.
If you add the ‘Send an HTTP request to SharPoint’ action and use the user ‘Email’ dynamic content Power Automate should add automatically the necessary loops.
Does this method send an email to the user telling them they have been added to the group (I would rather it didn’t)? Thank you for the explainer – very useful!
Hi Emily! No. But you can add an outlook send an email action after the Http one.
Hello Emily,
no, it shouldn’t send any emails, but it’s always better to do one test run with one of your colleagues to make sure.
Hi Tom
Do you know any option, to add Sharepoint User Groups to permissions (RLS, etc.) instead fo individual users in Power Automate? I would like to manage the Members outside of Power Automate and just use the groups…
Many thanks in adavance, A MA
Hello A MA,
there’s an article dedicated to adding permissions for SP groups: https://tomriha.com/how-to-add-permissions-to-sharepoint-group-with-power-automate/