Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Retrieve Office365User Email Addresses

(2) ShareShare
ReportReport
Posted on by 4,517
I have Screen1, on which is TextInput_1 and Gallery_1.

TextInput_1 is being auto-populated with names from a
SharePoint List based on choices made elsewhere.

I would like the Gallery_1 Label to auto-populate the email
addresses (from Office365Users) associated with the names
in TextInput_1.

I have tried the following in the Gallery_1 Label, but I'm getting
an error.

What am I missing?
 
LookUp(Office365Users.SearchUser({searchTerm:(TextInput3_1.Text)})
 
Categories:
  • Suggested answer
    DBO_DV Profile Picture
    DBO_DV 4,415 on at
    Retrieve Office365User Email Addresses
    To do that you would have to change the formula quite a bit. 
     
    You would need to do somehting like this: 
    //OnChange or on a button select after entering the names
    Set(varNames,Split(TextInput3_1.Text, "; "))
    //the initial formula shold be changed like this 
    ForAll(varNames, 
       First(Office365Users.SearchUser({searchTerm:(ThisRecord.Value)}).value).Mail)
    Let me know how this worked. 

    If this solved your problem, please mark it as Solved to help others find the solution faster.
    If you found it helpful, consider giving it a Like to support each other in this community!

    Thanks, and happy building!

  • BD-01080338-0 Profile Picture
    BD-01080338-0 22 on at
    Retrieve Office365User Email Addresses
    When I type Curtis I get my email address returned to the Gallery.
     
    However, if I type in John Smith (comma or semi-colin) Curtis (and my last name), no email appears in the Gallery.
     
    I am trying to create a formula that returns all emails for all names entered into the TextInput.
  • DBO_DV Profile Picture
    DBO_DV 4,415 on at
    Retrieve Office365User Email Addresses
    Hey @Phineas
     
    Whta Happens if you only tipe in Curtis? 
    Still no answers? 
     
    Let me know what happens afterwards we tackle the next issue
  • Phineas Profile Picture
    Phineas 4,517 on at
    Retrieve Office365User Email Addresses
    I got the following to work.

    If I use User().FullName or hardcode my name into TextInput3_1.Text, the Gallery displays my email address.



    However, if I try to use the following there are no results.

    There are times when there may be one name returned, or two or more names returned to TextInput3_1.Text.

    How do I update the formula so that the email addresses associated with the names in TextInput3_1.Text appear in the Gallery?

    TextInput3_1.Text = (the property dropdown is on another screen)
    LookUp(WRApprovalsCollection,HOA = Property_Dropdown.Selected.HOA,Title &", "& User().FullName )

    Gallery Items = Office365Users.SearchUser({searchTerm:(TextInput3_1.Text)})

    Gallery Email Address Label = ThisItem.Mail
     
  • Verified answer
    BD-01080338-0 Profile Picture
    BD-01080338-0 22 on at
    Retrieve Office365User Email Addresses
    There will be at least two names in the TextInput field.
     
    Does this change the formula?
  • Verified answer
    DBO_DV Profile Picture
    DBO_DV 4,415 on at
    Retrieve Office365User Email Addresses
    Hey @Phineas
     
    Your LookUp is still open and has no arguments. 
    You xould also need to add a ".value" after the Office365Users function so that you get the table with the top 5 records. 
    To display it you should put it in a Gallery or look add a .Mail to it
     
    this would be what you are trying to get: 
    Office365Users.SearchUser({searchTerm:(TextInput3_1.Text)}).value // Returns top 5 results
    
    //get first result and display only the mail
    First(Office365Users.SearchUser({searchTerm:(TextInput3_1.Text)}).value).Mail
     

    If this solved your problem, please mark it as Solved to help others find the solution faster.
    If you found it helpful, consider giving it a Like to support each other in this community!

    Thanks, and happy building!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard