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 / ErrorMessage The metho...
Power Apps
Answered

ErrorMessage The method 'UserPhotoV2' has an invalid value for parameter 'id'

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

 

I browsed the whole community, and many had the same error message but none of the solutions worked.

 

The situation:

 

I have a gallery with a sharepoint list as a data source. The field "SendFrom" is a "Person or Group" field. I am retrieving the User Name from that "Send From" field and retrieving the Office365 Profile Picture through this. 

 

By the way I am in Germany so thats why the Office365 user syntax is different and some other syntax differences. This is the code I am using:

 

If('Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto=false;SampleImage;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email))

 

It shows me the profile picture. And for those that don't have a profile picture, it shows the sample image. So that works.

 

However I am still getting two error messages:

The method 'UserPhotoV2' has an invalid value for parameter 'id'

The method 'UserPhotoMetadata' has an invalid value for parameter 'userid'

 

I tried different additional approaches based on the solutions that I found here:

 

1. 'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email) -->1 Error Message + However does not show sample image in case the user has no profile picture.

2. If(IsBlankOrError('Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email));SampleImage;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email)) -->  1 Error Message + Sample Picture will not be shown in development mode but in the app you will see it.

3. If(IsBlank(ThisItem.SendFrom.Picture);'profilepic-generic-user';If('Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto=false;SampleImage;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email))) --> Shows nothing. Faulty Code.

4. If(IsBlank('Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email).ID);'profilepic-generic-user';If('Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto=false;SampleImage;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email))) ---> Shows nothing. Faulty Code

 

Any ideas?

 

Thank you so much!

 

 

Categories:
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Hi @Anonymous ,]

     

    The Office365User.UserPhotoMeta throws an error if the parameter is wrong ( the user mail provided is not in the O365 tenant), also  Office365Users.UserPhotoV2  throws an error if the parameter is wrong ( the user mail provided has no image set), so you have to avoid both of this kind of error you have to check first if the user's email is in the O365 tenant.

    For this you have to search the user with Office365Users.SearchUserV2({searchTerm:"email"}).value

    So the formula became:

    If(

        IsEmpty(

                Office365Users.SearchUserV2({searchTerm:ThisItem.SendFrom.Email}).value),

              SampleImage,

       Office365Users.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto,             

              Office365Users.UserPhotoV2(ThisItem.SendFrom.Email),

               SampleImage

    )

     

    Please forgive me, but i really don't know how to transform this in German way of coding 😊.

     

    Hope it helps !

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @gabibalaban ,

     

    thank you!!

     

    I used the following code as per your suggestion: 

     

    If(IsEmpty('Office365-Benutzer'.SearchUserV2({searchTerm:ThisItem.SendFrom.Email}).value);SampleImage;'Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email);SampleImage)

     

    It still gives me one error message:

     

    "The method 'UserPhotoMetadata' has an invalid value for parameter 'userid'

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

     @Anonymous  - Is there any posibility to have blanks  value in SendFrom.Email ? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Actually there are no blank entries in sendfrom. At the moment there are 21 entries from 4 different persons. Each of them has corresponding email-addresses. Thats why I would not expect any blank value.

  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    Hi @Anonymous ,

     

    This is my last try 😊 ...I had a test on my side and everything works fine (no matter if the email is from inside or outside the tenant).

     

    If(IsEmpty('Office365-Benutzer'.SearchUserV2({searchTerm:ThisItem.SendFrom.Email}).value) || IsEmpty(ThisItem.SendFrom.Email);SampleImage;'Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email);SampleImage)

     

    After you update the formula, please save and publish the app, and open it in PLAY mode.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you. Still the same error unfortunately ..

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Maybe another hint. This gallery should show the credit balance for a specific user. Sometimes there is no entry in the respective sharepoint list for that specific user and that is where the error message comes from I guess?

     

    The current code I am using:

     

    If(IsEmpty('Office365-Benutzer'.SearchUserV2({searchTerm:ThisItem.SendFrom.Email}).value);SampleImage;'Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email);SampleImage)

     

    Current error message:

    The method 'UserPhotoMetadata' has an invalid value for parameter 'userid'

     

    I guess he is stuck in this part "'Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto" because he wont find any user because the sharepoint list has no entry for this specific user yet.

     

    Any ideas? Thanks!

     

  • Verified answer
    CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @Anonymous ,

     

    Oups ...Sorry for my formula, the ThisItem.SendFrom.Email is string not record, please reconsider to this form:

     

    If(IsEmpty('Office365-Benutzer'.SearchUserV2({searchTerm:ThisItem.SendFrom.Email}).value) || IsBlank(ThisItem.SendFrom.Email);SampleImage;'Office365-Benutzer'.UserPhotoMetadata(ThisItem.SendFrom.Email).HasPhoto;'Office365-Benutzer'.UserPhotoV2(ThisItem.SendFrom.Email);SampleImage)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you so much. This worked!!

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard