Add The Users To The SharePoint Groups Using Microsoft Flow

As we all know, Flow is a replacement for SharePoint Designer based workflows. In my one of the latest assignments I had a requirement to update (or) add the user to the SharePoint groups, but by default we do not have any connectors to do this. Hence, in order to achieve this we shall use the send HTTP request to SharePoint connector and pass the rest endpoint URL and its required parameters.

Here is the step by step approach:

Step 1

Navigate to your flows, click on add action, and choose the “Send HTTP request to SharePoint”. You can also search for this in the search box below or click on SharePoint to choose this action.

Send HTTP request to SharePoint

Step 2

Pass the required parameters,

Parameters
 
Site Address

Select the site where you want to add the users.

Method

POST, the method should post since we are adding the user.

Uri

_api/web/sitegroups(43)/users, this is the typical REST Endpoint URL to fetch the users from the particular group. Here (43) is the group ID. We shall not use the group name here we can only use the group id.

Headers

SharePoint Headers
 
Body

  1. {“_metadata”:{“type”:”SP.User”},”LoginName”:”xyz”}  

In place of xxxx, you shall replace it with your required name, you shall also use any of the people picker field names in place of XYZ.

Save the flow and test it; your users now should have been added to the group.