Emad GabrielThoughts, tips and shortcuts about building software
Power Platform

Microsoft Flow - Add user to SharePoint Group

In Microsoft flow there is no built in action to add a user to a SharePoint group. One way to achieve this is to use the "Send HTTP request to SharePoint"

sendhttprequest

in this action you need to


  1. Set the URL of the Site

  2. Set method to "POST"

  3. URI set to "_api/web/sitegroups({GROUPID})/users", example: _api/web/sitegroups(10)/users

  4. Add header with key="accept" and value = "application/json;odata.metadata=none"

  5. Add header with key ="content-type" and value = "application/json"

  6. Set the Body to be {'LoginName':'i:0#.f|membership|[EMAIL ADDRESS]'}, example: {'LoginName':'i:0#.f|membership|john.doe@domain.onmicrosoft.com'}


It would look like this

sendhttprequest2

 

This is tested with a SharePoint online connection but assume might work with on premise SharePoint as well.