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 / Office365 User Photo E...
Power Apps
Answered

Office365 User Photo Error: the method 'userphoto' has an invalid value for parameter 'userid'

(0) ShareShare
ReportReport
Posted on by 16

Hello,

 

i'm fighting with a problem, whats well known but nobody really solve it for now/or maybe just for me.
I have the following code in a templateGalleryList Image inside the image property field:
In the GalleryList are a few "user" objects from a SharePoint list with fields like Email, whats the UserPrincipalName from our ActiveDirectory.

DavidPozun_0-1669127927339.png

The Code is in german, so the syntax is a little different to english but as you can see there is no error in the formula and its working fine except the Error Message as shown below.
When i play the App in the Editor, there is no error.
When i start the app from Teams or in Web from a link, i get on app start this error:

DavidPozun_1-1669128364840.png

In english, this means: 
Error: the method 'userphoto' has an invalid value for parameter 'userid'

As you can see in the code above, i was trying to implement error handling with: IsError() but this does not hide the error for the users...
I have the IsBlank Method for the mail, if its empty. I have the SearchUser Method inside an IsEmpty method for checking the user in O365 exists before asking for the picture...

All photos are displayed and the error is not having any affect but we want to hide the error message for the users (we have over 1.000 Users).
I would really appreciate your help in this case! Im done^^

Best regards,

David

Categories:
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @DavidPozun 

     

    How about you try a different approach? 

    If(!IsBlank(ThisItem.About_Resource),Office365Users.UserPhoto(ThisItem.About_Resource))

    More details here, same error as yours.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/UserPhoto-and-UserPhotoV2-error/m-p/317013#M91130

  • DavidPozun Profile Picture
    16 on at

    Hello @cha_cha 

     

    Thank you for your fast reply!
    But as you can see, i have already this formula inside my code.
    This thread was the starting point for me in this case.
    When i remove the whole code and just put this code from you inside and change the variables to mine, it makes no difference.
    In Editor no error in normal app play, same error....
    I have heard something about a limitation of the office365 connector. Could it be that this is the matter for this?

  • Verified answer
    cha_cha Profile Picture
    4,932 Moderator on at

    Hello @DavidPozun 

     

    Are you using the O365 code somewhere else in the app like maybe your own photo in your App?

     

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @DavidPozun,

     

    Your code looks good, and I would expect the IfError function to mask errors as expected.

     

    However, I cannot see any commas within the If functions in the screenshot. The If function has the following syntax:

     

    If( Condition, ThenResult [, DefaultResult ] )

     

     

    If function reference: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-if

     

    I would suggest re-writing the code block from scratch and building it back up so it works as expected.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • DavidPozun Profile Picture
    16 on at

    Hi @KeithAtherton 

     

    thank you, thats what i also expect!

    The syntax is correct, as in german the syntax for IF is:

    If( Condition; ThenResult [; DefaultResult] )

     Just dont mind about the syntax, its different between US and EU...

    @cha_cha 

    Yes i do!
    At the AppStart i have the Code:

    DavidPozun_0-1669131606337.png

    So the variable: varTest has the Email Adress from the logged in user as "lower" (So all letters are low)
    And outside the GalleryList i have a picture from the logged in User:

    DavidPozun_1-1669131728188.png

    And i also access the picture from the gallerylist in another screen:

    DavidPozun_2-1669131829812.png

    But the error comes at the appstart directly when the app opens, so i do not expect the error comes from the other screen...

     

     

  • Verified answer
    KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Thanks @DavidPozun, that explains the commas/semicolons 🙂

     

    I would suggest wrapping all Office 365 Users calls with IfError to see if that suppresses all errors.

  • DavidPozun Profile Picture
    16 on at

    Thank you @KeithAtherton 

     

    I wrapped all Office365-Users commands in IfError( blabla; "" ) and this worked for me.
    No more errors at the appstart!

    Also Thank you @cha_cha  !

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

     Glad to hear it! 🙂

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

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard