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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / UserPhotoMetaData User...
Power Apps
Unanswered

UserPhotoMetaData UserID Error

(2) ShareShare
ReportReport
Posted on by

Hey guys,

 

Sorry, I know that there are many discussion opened about this matter but I didn't understand if there is a solution or if Microsoft team is working on it.

I have tried many ways to avoid the error but without success. What is funny is that the code is working, but with this annoying error message.

 

Code

If(Office365Users.UserPhotoMetadata(sharepointID).HasPhoto=true,Office365Users.UserPhotoV2(sharepointID),SampleImage)

Error:

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

IMG_B0545BE8702B-2.jpeg

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    Can you confirm what is the sharepointID that you are referring to? Office365Users.UserPhotoMetadata() expects the userid(Principal Name/ Email ID) of the user for which we want to search data for.

     
    Please make sure that you are passing correct data inside office365 function. 
     
    Here is an example of what I tried myself: 
     
    In this example, I used current logged in user's email id and if you want to fetch it from Sharepoint, please use the expression:
    Lookup(<<SP List>>,Name = "<Name of the User>").Email
    Name/Email will be replaced by attributes in your SP list.
    MicrosoftTeams-image (71).png

    Hope this Helps

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • Community Power Platform Member Profile Picture
    on at

    Hi @yashag2255 ,

    thanks for coming back to me.

     

    One of my tentatives was getting the user id using Office365Users.UserProfile(InfoAbout.Text).Id and I have stored it as sharepointID.

     

    I have tried as well the code:

    If(Office365Users.UserPhotoMetadata(email).HasPhoto=true,Office365Users.UserPhotoV2(email),SampleImage)

    And I am facing the same error message.

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @Anonymous 

     

    As per your last response, I am assuming that you are setting up a variable(email) and then referencing it in the query.
     
    Can you please share a snippet/Screenshot of where exactly are you initializing this variable.
     
    Also, please share the screenshot of label text that is getting displayed if you use email variable as its text property. Through this, we will get to know what exactly is getting filled in the email variable, and what is passed as the argument for office365 query.
  • Community Power Platform Member Profile Picture
    on at

    Thanks @yashag2255 
    I am getting this variable from the database.

    Let me know if this screenshot helps:

    Untitled-1.jpg

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at
    @Anonymous 
    I see that you are able to get the image, please click on the red cross and share the error that you are getting now.
  • Community Power Platform Member Profile Picture
    on at

    Sure @yashag2255 , it is the same error.

    Screenshot 2019-06-03 at 16.58.59.png

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @Anonymous 

     

    That's Strange! I got the same formula working in my system. Can you try out few things:
     
    Before anything, this might be a caching issue. Can you save your app, logout of the current session and login back in a fresh browser window and check if the error still shows up? If it still does, can you try these out?
     
    You might want to delete your current connection to O365 and create a fresh connection too. 
     
    1) Place this expression on the Image control:
    If(Office365Users.UserPhotoMetadata(Text(ThisItem.Email)).HasPhoto=true,Office365Users.UserPhotoV2(Text(ThisItem.Email)),SampleImage)
     
    The strangest part is you are getting back the image and still getting the error.
  • Community Power Platform Member Profile Picture
    on at

    Yes @yashag2255 , it is completly strange.

    When I logout of the current session and login back in a freash browser the error vanishid, but I just click in the code and the error appear again.

    I just deleted the current connection to O365 and created a fresh one, I update the code you have requested and I received a different error:

    Office365Users.UserPhotoMetadata failed: { "error": { "code": "Request_BadRequest", "message": "Unrecognized query argument specified: 'userId'.", "innerError": { "request-id": "7cf2213c-6317-4215-951e-d18a2e1030ea", "date": "2019-06-04T10:43:13" } } }

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @Anonymous 

     

    I did a little research and there are few threads which see similar error with the UserPhotoMetadata connector. I tried the same code and it works fine for me. 
     
    Looking at your latest issue, I am guessing that only possible reason is the improper connection to office365, it is not recognizing userid which is a required attribute. So, please try to recreate the connection and type your command again.
     
    If(Office365Users.UserPhotoMetadata(ThisItem.Email).HasPhoto=true,Office365Users.UserPhotoV2(ThisItem.Email),SampleImage)
     
    Hope this Helps!
     
  • Community Power Platform Member Profile Picture
    on at

    I have tried but unfortunately I still getting the error.

    It is so frustrating because it is working but showing this error. I can't publish this version with this error being showing to the users.

     

    Thank you so much for your support and time.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard