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 / Using Office365Users w...
Power Apps
Unanswered

Using Office365Users with Metadata field error

(2) ShareShare
ReportReport
Posted on by 8

Hello everybody, 

 

I'm having some issues after reading several posts and researching online, (first time app maker). Im creating an app and would like it to display the logged in users profile picture. Here is the code I used:

 

If(Office365Users.UserPhotoMetadata(Office365Users.MyProfile().Id).HasPhoto = false,'generic-user-profile',Office365Users.UserPhoto(Office365Users.MyProfile().Id))

 

I do not get any errors in the online studio but, when using on the mobile powerapps, I get 2 errors: 

"Office365Users.UserPhotoMetadata failed: The method 'UserPhotoMetadata' has an invalid value for parameter 'userId' "

& 

"Office365Users.UserPhoto failed: The method 'UserPhoto' has an invalid value for parameter 'userId'  "

 

I honestly have no idead how to get this information to display without an error. The information displays but the error pops up on the mobile devices and doesn't look good. I've tried all possible combinations on a separate screen using text boxes to display just the user id and then pulling the photo information, it works but still shows the error. Does anybody else have any ideas feel like im hitting a wall. 

Categories:
  • Ahmed_Moussa Profile Picture
    Microsoft Employee on at

    Hi, have you got a resolution for this issue just yet ?

  • Techie1123 Profile Picture
    8 on at

    Sure, Don't.  

     

    I have been redoing the whole app trying to find a way around this issue.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I've got this same problem. Were you able to find a way around it?

  • Techie1123 Profile Picture
    8 on at

    Still waiting to find a solution or someone more knowledgable than me with powerapps.  I found a workaround that is working for the time being. There are several places in the app that I am using this functionality. The first is a picture of the current user on the app, like you are signed in. 

     

    Here is the code I am using:

    Office365Users.UserPhotoV2(User().Email)

    On the others like a contact list, I was unable to use the IF statement like I wanted to and use a placeholder picture if they did not have one in the AD. So I made my users insert a blank photo themselves into their account, sorta out of the way and not the way I would do it. But it was a workaround nonetheless. So...for my contacts list of members in the office I used a gallery linked to a sharepoint list with the contact info, as for the picture on each I just had the code look for the user in the active directory by email. I made a small box (hidden) with their email. 

     

    Code:

    Office365Users.UserPhotoV2(First(Office365Users.SearchUser({searchTerm:ThisItem.Email_x0020_Address})).UserPrincipalName)

    Hope this helps, I am still going to keep this open cause I would like to find a way to make this work.  Might run into the what if senario down the road of " I cannot access these workers and need them to change their AD picture" It'd be nice to do this on the fly without their knowledge.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Everyone,

     

    Please review the following blog post and let me know if it's helpful. 

     

    @Anonymous 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard