Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Power Apps | User().Email is NOT user email

Prologue

Every newcomer or even professional app maker may familiar with Power Apps’ User().Email function It’s very simple function that stands for the email of user who opened the app but there’s a catch!

What if I say User().Email function isn’t give you a user email !?


What is UPN

User Principal Name (UPN) is like human-friendly unique identifier of each user

However, when your IT department created your Microsoft 365 account, The UPN and email are the same value by default, but it can be changed by your IT.

There are no problem to let them the same value for small-mid size business

but for large organization (1-10k+ users) To avoid problem like duplicate name and to let everyone have same UPN pattern, Many times UPN is configured to be employeeNumber@company.com

  • UPN can be the same or differ from email address
  • UPN can be used as login credentials when user logging into Microsoft 365, email address can’t.
  • When sending email, the recipient will see email address as sender, not UPN

Problem with Power Apps

How this become a problem for Power Apps?

Well. I see many app maker use this function when they want to filter SharePoint list data

Filter(MyList, Person.Email = User().Email)

This code work fine if user’s UPN and email address are the same. but it won’ work when they are different because

  • Power Apps’ User().Email is giving us user UPN
  • SharePoint’s Person.Email is giving us user email address

As you can see that they are completely different values. So when you trying to filter based on this formula, you will not getting any result.


How to obtain actual user’s email

Good news is we can fix this by using Office 365 Users connector

By using this connector, It allow you to obtain almost every property of user’s profile. We can obtain user’s email address using this function

Office365Users.MyProfileV2().mail

So, now we can filter SharePoint person column using this function

Or you use this function to obtain email address of any users in organization using their UPN

Office365Users.UserProfileV2("upn@company.com").mail
,

Leave a Reply

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