Add Multiple Users to SharePoint Group together in one API call

Introduction

When managing SharePoint permissions, adding multiple users to a SharePoint Group can be tedious, especially when done one-by-one.

However, with Power Automate, you can simplify this process by using a single HTTP request to add multiple users at once. This article guides you through creating a Power Automate flow to streamline this operation.

Here are the step-by-step solutions for this use case.

Step 1. Go to the SharePoint site -> Site Settings -> People and Groups -> Select the group in which you want to add users.

You can get GroupId in the URL with the MembershipGroupId Parameter. Note down the groupId.

Now let's create a flow and add users to that group.

MembershipGroupId 

Step 2. Create a manual trigger flow. https://make.powerautomate.com/

Manual Trigger

Step 3. Add the "Send an HTTP request to SharePoint" action and add the API and body as below. Replace TenantName, SiteName, and UserPricipalName in the body. I get the MembershipGroupId from URL is 5.

  • Uri: _api/SP.Web.ShareObject
  • Body: {"url": "https://<TenantName>.sharepoint.com/sites/<SiteName>","peoplePickerInput": "[{'Key':'i:0#.f|membership|<UserPricipalName>'},{'Key':'i:0#.f|membership|<UserPricipalName>'}]","roleValue": "group:5"}

HTTP Request

Step 4. Run the flow manually and after a successful run, both the users are added to the group.

Sharepoint

Edit

Note

  • Ensure that the SharePoint Group ID and Site URL are correct.
  • Verify that you have appropriate permissions to add users to the SharePoint Group.
  • If the request fails, check the response for detailed error messages.

Conclusion

By using Power Automate to batch multiple user additions in one API call, you can save time and make your SharePoint Group management much more efficient.

This approach reduces API calls, simplifies permissions management, and offers a scalable solution for SharePoint administration.


Similar Articles