Get items for each user in multiple people picker field (Power Automate)

“Is there a way in Power Automate to split emails from a multiple people picker field to have a single email per user for all of the items in which they are included as an owner?”


Following a question from the original article to Send one email per user with multiple SharePoint items, what if the column is not a single people picker? What if the column allows selection of multiple users? If you have more than 1 user assigned per item? You probably still want to send only one email per user, even if they share the item with others.

Get user emails from the items

Once you switch the people picker column to multiple selection, its structure will change. It won’t be an object with the user anymore, now it’ll be an array of objects (=users). And as such you can’t get the email addresses as easily using the ‘Select’ action. You’ll have to use a less efficient way with double loops.

But first, initialise a new array variable, e.g. var_emailsArray. In that variable you’ll store each email separately. Once you initialise the variable, add ‘Apply to each’ to loop through all the items provided by the ‘Get items’. In that loop add another ‘Apply to each’ to loop through users in the people picker field. And in that loop place the ‘Append to array variable’ to store their email address.

Power Automate user items multiple people picker

Note: my column is called ‘SendTo’, your column will have most probably a different name.

At the end of the loop you’ll have a variable that’ll contain all the email addresses as separate items. Process it with the union(…) expression to keep only the unique values = unique emails.

union(variables('var_emailsArray'),variables('var_emailsArray'))

Filter the items for each user

The other difference from the original flow is in the ‘Filter array’ action. As already said, the people picker column in each item will contain an array of users. Therefore, you can’t simply filter by the user email. You must check the whole array of objects if one of them contains the email address. The easiest way is to convert the array into a string with the string(…) expression, which will allow you to use the ‘contains’ operator.

string(item()?['SendTo'])
Power Automate user items multiple people picker

From that point on you can continue with the original flow – build an HTML table and send the email.

Full flow diagram

I noticed the screenshot is missing a trigger, but it’s a ‘Recurrence’ trigger as in all reminder flows.

Power Automate user items multiple people picker

Summary

Once you switch from the single user to multiple people picker in SharePoint items, the Power Automate flows get more complicated. You don’t have a single object where you can easily access the email, you’ll get an array. And since it’s an array, you’ll have to loop through all the items, and for each item loop through the users. Once you’ve got them in a variable it’s easy to remove duplicates and filter the items with the little string(…) workaround.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

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