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 / Office365Users.UserPro...
Power Apps
Suggested Answer

Office365Users.UserProfileV2 - problem when the user is an external member

(0) ShareShare
ReportReport
Posted on by 6
Hello, 
 
I'm pretty sure this is actually a bug report - but not sure where I post them?  
 
We operate a multi-tenant organisation.  I'm building a Power App (Canvas App) that sits in an environment on a tenant where the majority of users are synced in as External Members.
 
The UPN of external members contains a couple of characters that are not URL safe.  E.g. username_domain.com#ext#@tenantname.onmicrosoft.com
 
If I use this method to look up a user by their UPN directly...
 
Office365Users.UserProfileV2("username_domain.com#ext#@tenantname.onmicrosoft.com") - then it works as expected.
 
However, most usually, we don't start with a UPN.  I'll instead have something like an email address from the "Created by" column in a SharePoint List.  If I look up a user by their email address, e.g. ...
 
Office365Users.UserProfileV2("username@domain.com") - then it fails.
 
The error message suggests that what is happening is that the email address is being looked up, and resolved to a UPN.  The UPN is then being looked up to fetch the user's profile data, but the UPN is not being encoded, and therefore truncated at the first "#" character.
 
{"error":{"code":"Request_ResourceNotFound","message":"Resource 'username_domain.com' does not exist or one of its queried reference-property objects are not present." .... }}
 
Or, that's very much what it looks like.  Note that the error message includes the UPN up to the point of the first character that is not URL safe.  
 
We've found this problem loads of times in SharePoint (e.g. the out-the-box Organisational Chart webpart doesn't work in this scenario because of the same issue).
 
Can anyone verify this, and suggest who I should contact, in this instance, to get Office365Users.UserProfileV2 fixed?
 
Thanks,
 
Steve.
Categories:
I have the same question (0)
  • Suggested answer
    venturemavenwill Profile Picture
    1,198 Super User 2026 Season 1 on at
    I am afraid the only option in this case would be to submit a new idea
     
    The issue here is that the official documentation for Get User Profile (V2) specifies that you need the UPN of the user in the organization, not the email address. (See: https://learn.microsoft.com/en-us/connectors/office365users/#get-user-profile-(v2)) Since the UPN of the external user is the #ext# string it is not a "bug" per say. 
     
    What if, as a workaround, you get the UPN of the user in a list somewhere, look it up, and the use the UPN for the connector?
  • Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    HI , you can leverage Entra Object ID and get the results ,
    Something like 
    Office365Users.UserProfileV2(User().EntraObjectId)
    if you want to find the relevant user using graph api you can try this :
    https://graph.microsoft.com/v1.0/users/entraid with
    Office365Users.HttpRequest()
     
  • SS-30071228-0 Profile Picture
    6 on at
    Thanks for the replies.  I get that the function is meant to take a UPN or Entra object ID as an argument.
     
    However, it does also (even if unofficially) support email addresses too - providing the matching account's UPN is URL Safe.
     
    I tried it on an account which (a) has a different email address to the UPN, and (b) does have a URL safe UPN - and it works perfectly.
     
    Hence, there is definitely an issue with the backend code not encoding the UPN before sending it off (presumably to the Graph API).
     
    My frustration is that we come across this issue in Microsoft's cloud products all the time - making it harder than it should be to work in a multi-tenant organisation.
     
    Our work around is:
     
    First(Office365Users.SearchUserV2({searchTerm:"user@domain.com",top:1}).value).GivenName

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
Vish WR Profile Picture

Vish WR 936

#2
Valantis Profile Picture

Valantis 602

#3
11manish Profile Picture

11manish 598

Last 30 days Overall leaderboard