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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Office 365 Users Conne...
Power Apps
Suggested Answer

Office 365 Users Connector

(1) ShareShare
ReportReport
Posted on by 25

Hi everyone,

I am building a commenting feature in Power Apps embedded inside Power BI, where users can tag others similar to social media or WhatsApp (@mentions).

For this, I am using the Office365Users connector to fetch users from my organization and display them in a ComboBox.

🔹 Requirement

I want users to:

  • Select people from a ComboBox
  • Store only their email addresses in a SharePoint list
  • Later use those emails in Power Automate to send notifications


🔴 Issue

The data returned is inconsistent:

  • Some users show Display Names
  • Some show Email addresses instead of names
  • In some cases, DisplayName is blank or not reliable

🔹 Expected Outcome

I want:

  • ComboBox to strictly use Email (Mail or UserPrincipalName)
  • Avoid any inconsistency between DisplayName and Email
  • Ensure only email values are stored in SharePoint

🔹 Questions

  1. How can I enforce the ComboBox to only use email values from Office365Users?

🔹 Additional Context

  • Power Apps is embedded inside Power BI
  • SharePoint list is used as backend
  • Goal is to build a tagging/notification system

    My current items formula for the combobox:

     
    With(
        {
            users: Office365Users.SearchUser({
                SearchTerm: Self.SearchText,
                top: 100
            })
        },
        SortByColumns(
            AddColumns(
                Filter(users, !IsBlank(Coalesce(Mail, UserPrincipalName))),
                UserEmail, Coalesce(Mail, UserPrincipalName),
                UserDisplay,
                    If(
                        IsBlank(DisplayName),
                        Coalesce(Mail, UserPrincipalName),
                        DisplayName
                    )
            ),
            "UserDisplay",
            SortOrder.Ascending
        )
    )

     
    Once I get the Correct EMails, consistent. I will store them in sharepoint list and use trigger in power automate to send EMail to that EMail addresses and user will get notification EMail.
     

Any guidance or best practices would really help.

Thanks & regards,
Ashfaque Sayyed

Screenshot 2026-04-24 194932.png
Screenshot 2026-04-24 195035.png
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    155,111 Most Valuable Professional on at
    The code you posted is doing exactly what you have asked. Assuming you are using UserDisplay in your DisplayFields in the Combo Box, I have added some notes below. I suspect you have a lot of missing information in your Entra data.
    With(
       {
          users: Office365Users.SearchUser(
             {
                SearchTerm: Self.SearchText,
                top: 100
             }
          )
       },                         //grab the list of users matching the user input
       SortByColumns(
          AddColumns(
             Filter(             //now filter it
                users,
                !IsBlank(
                   Coalesce(     //make sure the Mail or UserPrincipalName contains data
                      Mail,
                      UserPrincipalName  //this should never be blank, so the filter is probably a waste of time
                   ) 
                ) && AccountEnabled      //suggestion to add
             ),
             UserEmail,         //Add a column of either the Mail or UserPrincipalName
             Coalesce(
                Mail,           //Mail also should never be blank
                UserPrincipalName
             ),
             UserDisplay,       //Add a column to display in the box
             Coalesce(          //Coalesce can contain multiple item and finds the first non-blank
                DisplayName
                Mail,
                UserPrincipalName
             )
          ),
          "UserDisplay",
          SortOrder.Ascending
       )
    )
    So I suggest this is all you need 
    With(
       {
          users: Office365Users.SearchUser(
             {
                SearchTerm: Self.SearchText,
                top: 100
             }
          )
       },
       SortByColumns(
          AddColumns(
             Filter(
                users,
                AccountEnabled
             ),
             UserEmail,
             Coalesce(
                Mail,
                UserPrincipalName
             ),
             UserDisplay,
             Coalesce( 
                DisplayName
                Mail,
                UserPrincipalName
             )
          ),
          "UserDisplay",
          SortOrder.Ascending
       )
    )
    which will find the first non-blank value from (in order), DisplayName, Mail, UserPrincipalName. 
     
    Please ✅ 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 answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Suggested answer
    Haque Profile Picture
    2,008 on at
     Hi @AS-16011928-0,
     
    I strongly suggest what @WarrenBelz mentioned. The vital part he mentioned is "I suspect you have a lot of missing informaition in your Entra data".  Based on this I have some points to add :
     
    The crux part of the issue is: Some users show Display Name, some show email addresses instead of names and in some cases, DisplayName is blank or not reliable

    Root Cause (Why this happens): User profile in the Azre AD might have incomplete profile, saying that we :
    1. Some users may not have their DisplayName set or synced properly in Azure AD.
    2. The Office365Users connector sometimes returns different fields depending on the user’s profile completeness or privacy settings.
    3. For guest users or external accounts, DisplayName may be missing or replaced by email.
    4. The connector’s SearchUser or GetUserProfileV2 actions can return slightly different data sets.
    Let's be vigilant: When we use Office365Users connector to fetch users from organization - before fetching users can we dump them in an excel to observe what are the variables/variations in the person’s details? In some way - if we can fix at the root/source level – we can minimize patching up at the apps level increasing performance and computational efficiencies.

    Automate Correction for Existing Items: Run the flow on existing items to fix inconsistent Person fields. Optionally, schedule a batch flow to clean up historical data?

     
    NOTE: The Person or Group column stores a reference to a user in the SharePoint User Information List. It usually displays the user’s display name but stores the user’s login/email internally. If users are added inconsistently (e.g., via text fields, manual input, or different sources), the column may show inconsistent data
     
    Where to stick: As your email address is very important - I would suggest when you fetch people, if there are no email addresses – skip that one. One of the best safeguards you must do is enforce ComboBox to use only email values from Office365Users. I understand searching display name gives comfort from user perspective – but you don’t’ want to miss sending email from Power Automate! Again – it is my suggestion, you can overrule. Here are some ideas to be strict on email address (if you want):
     
    ComboBox Items Property (apart from any filters): Office365Users.SearchUser({searchTerm: Self.SearchText, top: 20})

    ComboBox Display and Search Fields: Set the ComboBox properties to strictly show and search by email:
    • DisplayFields: ["Mail"]
    • SearchFields: ["Mail"]             
    ComboBox Layout: Let's set some property to get help from layaout
    • Set the ComboBox’s IsSearchable property to true to enable searching by email.
    • Optionally, set the NoResultsText property to a user-friendly message like "No users found with that email".
    Storing Selected Emails in SharePoint
    • When saving the selected users to SharePoint, store only their email addresses by concatenating (if needed) the selected items’ Mail property: Concat(ComboBox1.SelectedItems, Mail, ";") 
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 516

#2
WarrenBelz Profile Picture

WarrenBelz 450 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 448

Last 30 days Overall leaderboard