I'm seeing some odd behavior when getting user details by Alias in Office365Users.
I'm at a large org and we tend to use alias in many systems as our identifier.
In this app we'd like to be able to type in an alias and pull back a user's information.
I've found that Alias works totally fine with UserPhotoV2 -- Office365Users.UserPhotoV2("alias@company.com") returns the profile photo.
However Office365Users.UserProfileV2("alias@company.com").DisplayName returns an error of "user not found"
What the story here -- why does one function allow me to use Alias as an ID, and another doesn't? Is this a bug?
Posted a solution in the wrong topic- had to many tabs open- ignore this please and my apology.
HIi @RezaDorrani
I have a question. I am isung the same Expression und I am getting the result ( the id).
But I getting a notification that Userprofil() methode as incorrect paramater
Office365Users.UserProfileV2(PrimEmailUser).id
PrimEmailUser ist ThisItem.'Owning User'.'Primary Email' ( I am using here a gallery and Source = Cases from CRM dynamics 365).
I am gettign this error when I reload the cases via Revert function
I'm 2 years late, but in case anybody else stumbles across this like I did...
I had a similar problem. I had some users who are in the Office365Users collection and can be found using the Search function. But when I tried using their Mail property to get a photo (UserPhotoV2) or profile (UserProfileV2), it failed with the above error (bad id, reference properties missing, etc.).
But... If I took the objects from the Search results and used the UserPrincipalName, not Mail, to pass to the UserPhotoV2 and UserProfileV2 functions on Office365Users, that worked.
Hi @v-bofeng-msft -- alias is an alternate email address. "Alias" is a Microsoft/Outlook term, it's not ours!
Again my confusion comes from being able to use Alias with UserPhotoV2, but alias failing to work with UserProfileV2.
According to the documentation you shared, the two functions accept the exact same parameters, "User principal name or email ID"
So it does not make sense that a user's alias works in one function but does not work in the other.
Hi @Anonymous :
Thank you very much for exploring PowerApps and pointing out this problem.
Have you solved your problem?
According to the definition of this in the document, we should only use User principal name or email id to retrieve data. Could you tell me what is the alias?
Get user photo (V2)
Parameters
Get user profile (V2) Parameters
Best Regards,
Bof
For these "Contacts" or "Guest Users," are you finding that UserPhotoV2 works fine with an alias, but only UserProfileV2 fails with an alias?
Just to be 100% clear about the strange behavior I am seeing:
Let's say I have some user John Doe, they have email John.Doe@business.com and an alias of JD123
The end goal is to be able to enter JD123 into my PowerApp and return user details.
I am finding that both functions (UserPhotoV2 and UserProfileV2) resolve correctly if I use John.Doe@business.com
I am finding that UserPhotoV2 resolves correctly but UserProfileV2 fails to resolve if I use JD123@business.com , with error code "ResourceNotFound" and message "User Not Found"
I am able to eventually get the user's profile by using SearchUsersV2 with searchterm JD123
It is not clear to me why UserPhotoV2 can resolve my users by alias@business.com but UserProfileV2 cannot. This is occurring for every user I have tested in my organization.
Hi @Anonymous
The first thing I want to explain is that "DisplayName" is the wrong parameter name, and the correct parameter name is "displayName".(Although PowerApps may sometimes correct it automatically)
I was also surprised to see this strange issue, so I spent some time doing the test.
At first I thought it was a user's permission problem, when I use a test account that does not have access to the admin center to test, both formulas worked well.
Finally, I tried to use the email addresses of different types of users as parameters, and the problem occurred:
Active users: the formula works very well.
Contacts: the formula “Office365Users.UserProfileV2” reports an error, the content is: "User Not Found".
Guest users: the formula “Office365Users.UserProfileV2” reports an error, the content is: "Resource does not exist or one of its queried reference-property objects are not present".
At the moment I am not quite sure what is causing your problem, but I suggest that you can go to the admin of your organize and ask him what type of the user you are searching for.
Best Regards,
Bof
@Anonymous
Not sure if I understood the question
But when I tried Office365Users.UserProfileV2(User().Email).DisplayName - Gave me a syntax error
whereas Office365Users.UserProfileV2(User().Email).displayName - works
--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
WarrenBelz
89
Most Valuable Professional
MS.Ragavendar
60
stampcoin
48