How to Send Email to SharePoint Group in Power Automate

Do you need to send an email based on the membership of a SharePoint group in Power Automate?

Unfortunately, SharePoint groups don’t have an associated email address like the more modern Office group implementation.

This means you will need to get a list of your SharePoint group members and their emails. This can be done with an HTTP request to the SharePoint API.

This post will show you how to use the Send an HTTP request to SharePoint action to get the group members and then send them an email.

Get SharePoint Group Membership with HTTP Request

The first step in the process will be to use the Send an HTTP request to SharePoint action from the SharePoint connector to return an array of members.

This will return an array of members along with various data points that include the user’s email address.

Here’s how to get the group members.

  1. Add the Send an HTTP request to SharePoint action to your flow.
  2. Select the SharePoint Site Address that contains the group you want to email.
  3. Select GET as the Method.
_api/web/siteGroups/getByName('Your Group Name')/users
  1. Add the above path to the Uri field. Replace the Your Group Name with the name of your group. This can include space characters.

This API endpoint will return all the users in the group.

Select Email Addresses from HTTP Request Body

The HTTP action will return an array filled with a lot of data for each user.

To send an email to each user, you will only need their email address from the output. This means you will need to use a Select action to get an array that only contains the email address.

Here’s how to reduce the array to only contain the email field.

  1. Add the Select action from the Data Operations connector.
@{body('Send_an_HTTP_request_to_SharePoint')['d']['results']}
  1. Add the above expression to the From field. This is the array of group members returned from the Send an HTTP request to SharePoint action.
  2. Click on the Switch Map to text mode option to the right of the Map field input. This will switch the input into a single field.
@item()['Email']
  1. Add the above expression to the Map field. This will select only the Email field from each item in the array.
["john@example.com","ashley@example.com","tim@example.com"]

Now you will have an array that only contains email addresses. The output will look something like the above array.

Join Email Addresses

Now that you have an array with the email address, you will need to join these into a single delimited string that can be added to the To field in an email action.

This will create a comma or semicolon separated list of email addresses.

Here is how to convert the array to a delimited list of emails.

  1. Add the Join action from the Data Operations connector.
  2. Add the Output from the Select action to the From field of the Join action.
  3. Add a comma , or semicolon ; character to the Join with field.
john@example.com;ashley@example.com;tim@example.com

The result will look something like the above string.

Send an Email to Group Members

Now you will be able to use the output from the Join action to send your emails.

Here’s how to send an email with the joined string.

  1. Add the Send an email action from the Outlook connector.
  2. Click on the Switch to Advanced Mode option found to the right of the To field. You will need to first click into the To field before you will see the switch button. This will switch the field to a text input mode and allow you to use the out from the Join action.
  1. Add the Output dynamic content from the Join action in the To field.
  2. Add your Subject and Body to the email action as required.

Now the email will be sent to all the members of the SharePoint group. This is a dynamic solution since as the group membership changes it will change the output of the HTTP action.

Conclusions

SharePoint groups don’t come with an email address that can be used to email all members of the group.

Emailing the group members with Power Automate can still be achieved in a dynamic manner by using the HTTP action to list all members.

But, further manipulation is required to get only the email address.

Hope this has helped you to send emails to your groups in a flow. Let me know in the comments!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Subscribe

Subscribe for awesome tech videos 😃

Related Articles

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!