web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Get User Profile from ...
Power Apps
Unanswered

Get User Profile from string

(1) ShareShare
ReportReport
Posted on by 405
Hi all,
 
I'm working on a Power App and the data that was given has a column type of string with users name in the following format (firstName lastName). I need to be able to pull their account using O365 connector in a combo box, but I haven't been successful. 
 
Has anyone tried this in the past? if so, can you please point me in the right direction? 
 
Cheers,
I have the same question (0)
  • EE-04041031-0 Profile Picture
    104 on at
    ✅Yes, you can use the Office365Users connector to resolve a user's full name to their account. In your ComboBox `Items` property, use:
    Office365Users.SearchUser({searchTerm: TextSearchBox1.Text})
    Then set:
    - `DisplayFields` = ["DisplayName"]
    - `SearchFields` = ["DisplayName"]
    - `DefaultSelectedItems` (if needed) = LookUp(Office365Users.SearchUser({searchTerm: "John Doe"}), DisplayName = "John Doe")
     
    Since you're starting with full names as strings, you’ll need to pass the name to `SearchUser` and handle possible duplicates manually.
     
  • _sourcecod3_ Profile Picture
    405 on at
    Hi @EE-04041031-0,thanks for your response, but that did not work. 
     
    This line doesn't populate anything: Office365Users.SearchUser({searchTerm: TextSearchBox1.Text})
     
  • Suggested answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at
    Your issue here is that you only have the name and you need to retreive enough of the profile to then update the data card containing the user you have referenced. I will assume here that the name of the user is in a Text Box and you have a Combo Box searching other users if required and want the details defaulted (both controls are classic items in this example). This is also assuming new records only (see below for existing records also) .
     
    Firstly the Items of the Combo Box
    Office365Users.SearchUserV2(
       {
          SearchTerm: Self.SearchText,
          isSearchTermRequired: false
       }
    ).value
    and DisplayFields
    ["DisplayName"]
    and DefaultSelectedItems
    {
       DisplayName: YourTextInputName.Text,
       Mail: First(Office365Users.SearchUserV2({searchTerm: YourTextInputName.Text}).value).Mail
    }
    Now the Update of the Data Card
    {
       Claims: "i:0#.f|membership|" & Lower(ComboBoxName.Selected.Mail),
       Department: "",
       DisplayName: ComboBoxName.Selected.Mail.DisplayName,
       Email: ComboBoxName.Selected.Mail,
       JobTitle: "",
       Picture: ""
    }
    If you want to work with existing records also, the DefaultSelectedItems would be something like
    If(
       YourFormName.Mode = FormMode.New,
       {
          DisplayName: TextInput8.Text,
          Mail: First(Office365Users.SearchUserV2({searchTerm: YourTextInputName.Text}).value).Mail
       },
       {
          DisplayName: ThisItem.YourPersonField.DisplayName,
          Mail: ThisItem.YourPersonField.Email
       }
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard