Recently, I was asked to create a Flow for a customer which had some approvals, notifications and some other stuff in it. One of the scenario’s I had to implement was to send a notification to a group of users. First thing that came to mind was to create a SharePoint Group and use the Send an Email action in Flow to send an e-mail to every user in that Group (like we did before in SharePoint Designer workflows).
Unfortunately, Microsoft Flow (currently?!) does not have to possibility to send an e-mail to every user inside a SharePoint Group so I had to came up with another idea.

The Solution

Microsoft recently launched a new Flow action called ‘Send an HTTP request to SharePoint’. With this action you can call the SharePoint REST API and perform all sorts of operations. With this API, you can get all users in a specific SharePoint Group with the following REST call:


To get all e-mail addresses from all users within a specific SharePoint Group with Microsoft Flow, you must configure your Flow as follows (I configured this in a custom action Flow, but you can use this in any other flow as well – e.g. a Flow that runs on create or on modified):
First, you want to make the REST call to SharePoint, so you add the Send an HTTP request to SharePoint action and configure it so that you call the API as stated above.

No need to fill in headers and body and the use of complex dictionaries like we had to in SharePoint Designer REST calls!

Next, we must write all results into an array variable by using the ‘Initialize variable’ action. Make sure you select the Array type. The value we are looking for is the outcome of the HTTP request which is the Dynamic content attribute of the Send an HTTP request to SharePoint action called ‘Body’.

Please note that Body will not always appear in the Dynamic content tab. To make sure it does, you can switch to the Expression tab and type something random (like a dot). When you switch back to the Dynamic content tab (no need to click on OK inside the Expression tab), Body will be available. Make sure you remove the random entry before selecting the Body.

We need to make a slight adjustment to the Body to get the results into the variable. That adjustment is to trim the body to only get the results. To do this, simple add [‘d’][‘results’] to the end of Body. The value should look like this:


Next, we must iterate to every entry inside the array to get specific user information (in this case the e-mail address of the user). Before we start the ‘Apply to each’ loop to iterate through the array, we must initialize two variables:

NameTypeValueUsed for
iInteger0Get values from array
userStringSetting the e-mail addresses for every user found

The Apply to each gets its input from the array variable we created before.

To make sure we add every property to the user variable, we need to add the ‘Append to string variable’ action (instead of the ‘Set variable’ action, which only sets the current iteration property and overwrites the previous property) and append the Email property of the user from the current iteration into the variable ‘user’, followed by a semicolon to make sure both properties are separated from each other.

If you are familiar with arrays, you know that an array iteration starts at 0 (that’s why we need the ‘i’ variable and set its value to 0). The next iteration will be 1, etc.

We need to build the value of the Append to string variable action ourselves, because we have to append the property and the semicolon by using the concat() expression.

To do this, go to the Expression tab and select the concat function under string functions. The function will be added to your Expression builder (your cursor will be put inside the concat function. Do not change this!).
Next, we must get the Email property from the user in the current iteration and place it into the first part of the user string variable. You can do this by going to the Dynamic content tab, click the users array variable and then add the starting square bracket (‘[‘). The closing square bracket will automatically be added and your cursor will stay within the square brackets so you don’t need to type the closing bracket. Inside the square brackets, add the i variable.
We now have the entry of the current iteration and need to get the e-mail address. To do that, we need to enter another starting bracket and type ‘Email’ within the brackets.

We now have built the first part of the string, which is the Email property of the user in the current iteration. To add the second part of the string, which is the semicolon, simply add a comma (which will take you to the second part of the user string variable), followed by ‘;’ (including the apostrophes) and make sure the concat function is closed properly with a bracket (this bracket is added automatically by selecting the concat function, but it’s best to check whether it’s still there after all these modifications).

Your expression should look like this:


Now you can use this variable inside a ‘Send an email’ action or an approval action. You can get other properties as well (e.g. DisplayName) by changing the [‘Email’] suffix to any other known user property.
To make sure we get the e-mail address from each iteration and not only from the first (i=0, as we configured it by initializing the variable), we have to end our Apply to each loop by incrementing our i variable at the end of the Apply to each loop by using the Increment variable action:

That’s it, you can now perform actions (e.g. send an email) on users in a SharePoint Group!


Previous articleAzure functions V2 with EF Core
Next articleAzure / Office 365 – 2 wekelijks overzicht – deel 45
My name is Rik de Koning and I work as a Functional Consultant for Portiva, which is one of the larger Office 365 implementation partners in The Netherlands. I started my career in 2011 as a SharePoint support engineer and in 2013, I went to become a SharePoint consultant where I did various projects on SharePoint Server 2010 and SharePoint Server 2013. In the last couple of years I started focusing more and more on Office 365, especially on SharePoint Online, PowerApps and Microsoft Flow. I like being challenged and for PowerApps and Flow being quite new, there are always some challenges when implementing these services. When I’m not working, I like spend some time with my family (girlfriend and son), hang out with friends, do some sports (like fitness, running, kitesurfing and snowboarding) playing videogames and just relax a little. If you have any questions, please do not hesitate to contact me!


  1. Hello Mr Rik,

    Thanks for your post, I want to add something, instead of using expressions to get the email from the body, there is an action in Power Automate called “Parse JSON”, you just need to give as an input the body of your request and the JSON template, the output will be every single information you need (Id, Email, Title … etc)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.