0
votes

We are developing a PowerAutomate Flow to automate the process of inviting external users to a SharePoint Site.

Below are the steps being followed so far

  1. Created an MS Form for an external user to register
  2. Passing the response**(Email)** from the form to the flow
  3. Adding the user to a SharePoint Group using email parameter and sending an email invite to the External User(Requirement)

I have been able to get to point no 2 , However I have been experiencing challenges achieving point no 3

Came across different articles online for adding a guest users , However most of them talk about adding the guest to Azure AD as shown below

https://medium.com/southworks/adding-a-guest-to-an-office-365-sharepoint-site-with-javascript-fa7604ad8678

https://laurakokkarinen.com/how-to-build-a-guest-user-self-service-registration-for-office-365-with-azure/

https://www.timlinenterprises.com/how-to-invite-external-users-using-microsoft-flow-and-microsoft-graph-api/

Also checked a few articles for running PowerShell commands from Flow , However this approach doesn't look straightforward either

The below article works only for internal users https://www.c-sharpcorner.com/article/add-the-users-to-the-sharepoint-groups-using-microsoft-flow/

The end goal here is to invite external user to a SharePoint Site once the user registers himself through a registration form (MS Form)

Would appreciate if anyone could help me out in achieving this.

Thanks in advance

1

1 Answers

0
votes

Before inviting the user to SharePoint you must add him to Azure AD. So you will need to configure an HTTP action to invite the user first.

If you are using SharePoint Modern Sites (those who have Microsoft 365 groups associated), you need to create a HTTP action to add the guest to the group: HTTP Action Configuration Here

NOTE: HTTP will not accept "@" sign directly, so you need to put it into a "Compose" or "Variable" and add it as per my screenshot.

In the URI you have the Group ID from Azure AD. In the Body it's the guest user ID

You will need to register and Azure AD App to use for the HTTP action and give it the following permissions:

Graph -> Application -> GroupMember.ReadWrite.All, Group.ReadWrite.All and Directory.ReadWrite.All https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=http#permissions

Use the App ID and Secret to connect the HTTP action.