cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
wagnerfraga
Level: Powered On

UserPhotoMetaData UserID Error

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

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: UserPhotoMetaData UserID Error

Hey @wagnerfraga It is frustrating but can we give it another try? 

 

Expression: If(!IsBlank(ThisItem.Email),If(Office365Users.UserPhotoMetadata(ThisItem.Email).HasPhoto=true,Office365Users.UserPhotoV2(ThisItem.Email),SampleImage))
 
Please try to use this one. There is a similar thread which resolved the error by putting a if condition around the ID and then referring to the same ID in office365 connector.
 
 
Hope this Helps!
 

View solution in original post

15 REPLIES 15
Dual Super User
Dual Super User

Re: UserPhotoMetaData UserID Error

Hi @wagnerfraga 

 

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!

wagnerfraga
Level: Powered On

Re: UserPhotoMetaData UserID Error

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.

Dual Super User
Dual Super User

Re: UserPhotoMetaData UserID Error

Hey @wagnerfraga 

 

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.
wagnerfraga
Level: Powered On

Re: UserPhotoMetaData UserID Error

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

Let me know if this screenshot helps:

Untitled-1.jpg

Dual Super User
Dual Super User

Re: UserPhotoMetaData UserID Error

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.
wagnerfraga
Level: Powered On

Re: UserPhotoMetaData UserID Error

Sure @yashag2255 , it is the same error.

Screenshot 2019-06-03 at 16.58.59.png

Dual Super User
Dual Super User

Re: UserPhotoMetaData UserID Error

@wagnerfraga 

 

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.
wagnerfraga
Level: Powered On

Re: UserPhotoMetaData UserID Error

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" } } }

Dual Super User
Dual Super User

Re: UserPhotoMetaData UserID Error

@wagnerfraga 

 

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!
 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,249)