Add Multiple Users To SharePoint Group Using Power Automate

You can use the “Send an HTTP request to SharePoint” flow action to add a user to a SharePoint group using Power Automate. We can also add multiple users to the SharePoint group, not just single users.

I will create two separate flows using Power Automate to add single and multiple users. And one more flow to add multiple users from a SharePoint list to the SharePoint group.

Unfortunately, Power Automate has no action to add a user to a SharePoint group or add permissions to a SharePoint group. So, we must use the SharePoint HTTP action.

Add User to SharePoint Group using Power Automate

In the first flow, we will create an instant cloud flow to add a single user to a SharePoint group.

Here, I have a Marketing Team SharePoint site that has three groups: Marketing Team Owners, Marketing Team Members, and Marketing Team Visitors.

I want to add a user to the Marketing Team Members SharePoint group.

Before creating the flow, ensure to get the SharePoint group ID, as we are going to use this ID in the flow action.

Follow the two steps below to get the SharePoint Group ID:

  1. Open the SharePoint Site Settings page, then click on Site Permissions. You will see all the SharePoint groups. Click on the group where you want to add the users.
add user to sharepoint group power automate
  1. This will open the “People and Groups” page for the SharePoint group. Navigate to the browser URL, and you can see the MembershipGroupId parameter. In this case, you can see MembershipGroupId=13. Here, 13 is the SharePoint group ID. See the screenshot below:
Power Automate add member to SharePoint group

Now, we will create an instant cloud flow and add an input parameter so that we can enter the user name to add while running the flow.

  1. On the Power Automate Home page, select Instant cloud flow with Manually trigger a flow trigger.
    • Input: Select a Text input to provide a user email.
Add User to SharePoint group
  1. In the next step, add the Get User Profile (V2) action to get the details of an Office 365 user.
    • User (UPN): Take value from the dynamic content of a trigger.
Power Automate Adding User to SharePoint Group
  1. Now, add the Send HTTP request to SharePoint action. Set parameters like Site Address and choose Method as the POST type from the drop-down.
    • Uri: Copy and add the code below.
_api/web/siteGroups/GetById(13)/users

You can provide your SharePoint group ID in place of 13.

Power Automate http request add user to SharePoint group
  1. Click on the Show all button to display all the Advanced parameters.
    • Headers: Click on the Switch to text mode button to the icon to input the json. Copy and paste the code below in the Headers section.
{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  • Body: Add the code below. Take the Mail from the dynamic content of the Get user profile (V2) action.
{
    "__metadata": {
        "type": "SP.User"
    },
    "LoginName": "i:0#.f|membership|@{outputs('Get_user_profile_(V2)')?['body/mail']}"
}
How to add member to SharePoint group Power Automate
  1. Then, save the flow and run it manually. In the Run flow pane, provide the user email that needs to be added to the SharePoint group. You can see from the image below that I have provided Lidia Holloway’s mail.
  2. Click on the Run flow button.
Add Member to SharePoint Group Power Automate
  1. Once the flow runs successfully, the given user is added to the SharePoint group. Take a look at the screenshot below.
How to add user to SharePoint group in Power Automate

This is how you can add a single user to a SharePoint group using Power Automate.

Add Multiple Users to SharePoint Group Using Power Automate

Here, let’s see how we can add multiple users to the Marketing Team Visitors SharePoint group by using Power Automate button flow.

Make sure to get the SharePoint group ID to which you want to add the users.

As you already know, the above example shows how to get the SharePoint group ID.

Power Automate add users to SharePoint group

Below are the steps to follow:

  1. Create a button flow in Power Automate by adding user input to the trigger.
    • Input: Choose user input as Email.

I have renamed it to User.

Adding multiple users to SharePoint Group
  1. Then, add a Compose action to split the multiple users.
    • Inputs: Insert the expression provided in the code.
split(triggerBody()?['email'],';')
Power Automate adding multiple users to sharepoint group
  1. Add Apply to each loop flow action, which will loop through all the users.
    • Select an output from previous steps: Take the Outputs of a compose action.
Power Automate add multiple users to SharePoint Online group
  1. Add Send an HTTP request to SharePoint flow action inside the Apply to each loop. Provide the following parameters:
    • Site Address: Choose your specific SharePoint site.
    • Method: POST
    • Uri: _api/web/siteGroups/GetById(4)/users [Replace 4 with your SharePoint group ID]
  2. Next, click on the Show all option to display the Headers and Body parameters.
Add members to SharePoint group Power Automate
  1. In the Header parameter, click on Switch to text mode icon. Copy and paste the below code.
{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  1. Into the Body parameter, insert the code below.
    • Add the Current item from the dynamic content of Apply to each action next to membership.
{
    "__metadata": {
        "type": "SP.User"
    },
    "LoginName": "i:0#.f|membership| @current item"
}
Add multiple members to SharePoint group Power Automate
  1. Now the flow is ready. Save the flow. Click on the Test icon on the top.
  2. In the Run flow window, search and add the users you want to add to the SharePoint group. Click on Run flow button.
    • I’m adding three users [Lidia Holloway, Alex Wilber & Grady Archie].
How to add users to SharePoint group Power Automate
  1. Once the flow runs successfully, the users will be added to the SharePoint group. You can have a look at the image below:
How to add multiple members to SharePoint group Power Automate

This is how to add multiple users to the SharePoint group by using Power Automate.

Add Users to SharePoint Group From a SharePoint List Using Power Automate

Here, I will create an Automated cloud flow that will trigger when an item is created in the SharePoint list.

Scenario: I have created a custom SharePoint group named [Marketing Sales Group ]. I wanted to add multiple users to this SharePoint group.

Add Multiple Users to SharePoint Group Power Automate

I have taken a SharePoint list with a couple of columns, as shown in the image below:

Column NameData Type
UsersPerson or Group – Allow multiple selections
Group NameChoice
Adding multiple users to SharePoint group by Power Automate

Follow the below instructions:

1. Select Automated cloud flow on the Power Automate Home page -> Choose When an item is created trigger.

Provide Site Address and List Name.

Adding multiple users to SharePoint Group using rest api by Power Automate

2. After that, add a Condition action to check the value of a Group Name.

Choose ValueOperatorChoose Value
Group Name/Valueis equal toMarketing Sales Group
Power Automate add bulk users to SharePoint group

3. Under the True branch of a condition, add Send an HTTP request to SharePoint action.

Configure the parameters

  • Site Address: Choose the SharePoint site where the groups are present.
  • Method: Select POST method from the drop-down.
  • Uri: Copy and paste the below code. Replace it with your SharePoint group ID.

In the above example, I have shown how to take the SharePoint Group ID.

_api/web/siteGroups/GetById(29)/users
  • Headers: Paste the code in the headers section.

Click the icon to switch to text mode.

{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  • Body: You can add the code below. Take User Claims, which is a person column with multiple selections.
{"__metadata":{"type":"SP.User"},"LoginName":"@{item()?['Claims']}"}
Replace the "LoginName":" Place the User Claims" of your SharePoint list column.
How to add multiple users to a SharePoint group with Power Automate

For each loop will be added automatically.

4. Now the flow is ready. Click on Save and Test the flow.

5. Return to the SharePoint list and create a new list item by selecting multiple users in the Users column for a particular SharePoint group.

How to add multiple members to SharePoint group by Power Automate

6. When the flow runs successfully, you can see that the multiple users have been added to the SharePoint group.

Refer to the image below:

Power Automate Adding multiple users to SharePoint Group REST API

This is how to add multiple users to the SharePoint group using a SharePoint list by Power Automate.

From this article, you will get to know about adding of users to a SharePoint group using Power Automate.

I hope this tutorial is helpful and understanding. If you have any questions please let me know in the comment section.

You may also like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…