cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

how to extract email address from a sharepoint person or group column that allows multiple selection

Hi, I have a SharePoint list named 'Systems' it has a Titlle field and a field called 'SustemMaintainer'.  'SystemMaintaiiner is  a 'Person Or Group' columns that allows multiple selections and people only.

 

In my flow I got the correct row by calling getItems and filtering based on the title column. so I have an array with one row, and that row has an a  column that contains an array of people columns:

[
    {
        "Claims": "i:0#.f|membership|russell.gove@xx.com",
        "DisplayName": "Gove, Russell",
        "Email": "Russell.xx@xx.com",
        "Picture": "https://xx.sharepoint.com/sites/GLMasterData/_layouts/15/UserPhoto.aspx?Size=L&AccountName=Russell.Gove@tronox.com",
        "Department": "Infrastructure Services",
        "JobTitle": "Sr SharePoint Architect"
    },
    {
        "Claims": "i:0#.f|membership|xx.xx@xx.com",
        "DisplayName": "xx, xx",
        "Email": "John.xx@xx.com",
        "Picture": "https://xx.sharepoint.com/sites/GLMasterData/_layouts/15/UserPhoto.aspx?Size=L&AccountName=John.Njoroge@tronox.com",
        "Department": "CFO Staff",
        "JobTitle": "Manager Accounting Analysis"
    }
]

How do I go about sending an email to the  Email addresses in that array.

The expression 

 

body('getItems')?['Value']?[0]?['SystemMaintainer']]

gets me the list of objects,  But how do i extract the email addresses from thos objects in a format thats sutable for sending an email?

37 REPLIES 37

@ScottShearer please I trying to use the emails to send approvals also and I have been stuck on this for about 2days now. I tried using your method and it works well but on inserting the variable in the “To” section of sending an email, it joins both email addresses together and that throws the error that the user doesn’t exist.

 

Can you help suggest how I can go about this so that it is able to separate the email as 

 

“email1; email2”  Instead of “email1email2”

ScottShearer
Most Valuable Professional
Most Valuable Professional

@Ade-O 

It would be best if you create a new thread/post and include detailed screen shots of your Flow.  If you @ mention me I will respond.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Hi @faustocapellanj 

 

Your approach has worked perfectly for me in workflows where my trigger is "when an item is created" or "when an item is modified". However, I also want to use it in a Reminders workflow, where the trigger is of "Schedule/Recurrence".

 

After using the same logic, I keep getting this error in my Select. I understand this is probably because in this scenario, the "Get Items 2" is getting items for each item from the first "Get Items", hence it automatically changed "Get Items 2" to "Apply to each 3". But I can't crack a solution or workaround to deal with this.

 

flow run failed.jpg

 

Any help would be highly appreciated. If you want me to clarify anything please let me know. Thanks!

REally good explanation! Helped me a lot!

Hi, Im trying to achieve the exact same. However when I use the first() function in the expression it only returns the first array and hence only the first email address for the person assigned to the field/column. Is it possible to do the same as you describe but extract all users emails addresses??

Hi Matt,

The solution that worked for me was the one @ScottShearer provided on the first page where you use an Apply to Each action to loop through the values in the column and store them in a variable.  

MattWearmouth
Frequent Visitor

Im not sure where the apply for each should go. I have spent a good few hours today trying to get this to work and failed. If anyone is available to give me a call to help that would be great! 

MattWearmouth_0-1643825647906.png

 

My attempt to use a apply to each got me somewhere but the outputs were empty...

 

Let me see if I can explain.

  1. First you initialize an array variable. From your screenshot it looks like you have one called Users Array. In my screenshot it's called varEmail ✔️
  2. Then you use the "Get items" action to get the items from your list, where the multi-select person or group column exists. We both have this action. ✔️
  3. The easiest way to create the "Apply to Each" action next is to use a "Set Variable" action to set the value to equal the multi-select people column from the "Get Items" action before. When you choose the Multi-select person or group column as the value of your array variable, it will automatically create the apply to each action for you.
  4. Move all of your other variables/actions inside of that same apply to each action.
    CarlHRVA_0-1643827320344.png

     

CarlHRVA_1-1643827413986.png

For clarity, here is what it looks like before you choose your multi-select column. After you select it, in my case "Assigned to", it will generate the apply to each for you

Had a little trouble using this solution, kept receiving error:

"The 'from' property value in the 'select' action inputs is of type 'Object'. The value must be an array."

 

Amended 'From' to outputs('Get_items')?['body/value']

And 'Map' to item()?['RequestManager']?['Email']

 

This fixed it, provided an array of all emails held within my 'RequestManager' person field.

Still not getting this work work. Getting this error for the 'Select' operation

MattWearmouth_0-1644435999667.png

 

MattWearmouth_1-1644436009757.png

 

 

Resolved! 

MattWearmouth_0-1644449659360.png

items('Apply_to_each')?['actionWith0']

 

item()?['Email']"}]

 

Jolinchang
Regular Visitor

Hi  @faustocapellanj good day

when "select" named "get mail" step, shows error as below after run, but the output from "get items" is not Null.

"The 'from' property value in the 'select' action inputs is of type 'Null'. The value must be an array."

any ideas, thanks so much

 

Jolinchang_2-1649328921051.png

 

Jolinchang_1-1649328767610.png

Jolinchang_3-1649329053430.png

 

 

 

This works for me but with one issue. Its only grabbing the first two emails from my sharepoint column? 

 

How can I make it grab all of them? A loop wont work for my use case. I am writing to an excel row which I'm using to add members to a group via powershell.

Anonymous
Not applicable

Sorry to bring up an old thread. I really cannot figure out how to do this. 

 

I need to get the email addresss from a sharepoint person or group column that allow multiple selection.

I need the emails because I need to perform an action "Grant access to an item or a folder" and the recipient must be email addresses.

 

I followed what is mentioned in 2019. However the "Select" action is changed. I tried it myself and I can get a Json respond like:

[
{
"": "email1@abc.com"
},
{
"": "email2@abc.com"
}
]

 

How can I convert above format into email1@abc.com;email2@abc.com;?

 

Colchester_0-1658754635265.png

 

Instead of leaving the Key blank, press this button and enter the formula there with no key. 

CarlHRVA_2-1658759322996.pngCarlHRVA_3-1658759367507.png

 


The result will look like the below.

 

CarlHRVA_1-1658759203513.png

From there use the Join action from Data Operations. Use the output of your select as the "From" and the semi-colon to join them.

CarlHRVA_4-1658759433261.png


If you are still having trouble please consider opening a new thread and tagging me if you need more help.

Thanks,

Carl

 

Thomas79
Regular Visitor

@faustocapellanj could this solution of getting emails as an output be used to set item level permissions for a SharePoint list item using that specific flow control? Forgot the actual name of it, just know it is there.

I.e. run a flow that (1) stops inheriting permissions on an item (2) gets the user emails from a [permission field] (just standard user/group field with multiple values) and then (3) use those emails to set the EDIT permissions for the item

 

Cheers and thanks, this was a good thread to read up on.

Hi,

If anyone is still active on this thread, I followed the above instructions but there is an error when it gets to the 'select email address' action - it says "The 'from' property value in the 'select' action inputs is of type 'Object'. The value must be an array'. My column type is a person or group, allowing selection of person only. Note: I have tried the expression starting with 'first' as well as the one below.

 

roxy1_0-1706661463408.pngroxy1_1-1706661496195.png

 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages