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 Apps
Unanswered

UserPhoto error

(0) ShareShare
ReportReport
Posted on by 440

I am creating a power app which is forever coming up with the following error 

Office365Users.UserPhoto failed: The function 'UserPhoto' has an invalid value for parameter 'userId' - a blank value was passed to it where it was not expected. Please make sure that a valid argument is passed to the function.

 

In the app I have a User Photo in the header for the current user, which is working fine. I also have a couple of entries in a gallery with User Photo's. Again both of these are working fine. When I have looked at past examples they imply that the ID's have no photo's assigned to them which is the cause of the issue, I have in this example, made sure the only ID's being used have a photo.

Categories:
I have the same question (0)
  • ahenn22 Profile Picture
    15 on at

    Try to use something like this, note that NoUser is a photo placeholder when no user is available 

     

    If( IfError( Office365Users.UserPhotoMetadata(ThisItem.BookedBy.Email).HasPhoto = true,"" ), IfError( Office365Users.UserPhoto(ThisItem.BookedBy.Email),"" ), NoUser )

     

    since you have not provided your code, you will have to change it a bit

  • Mitanshu Profile Picture
    1,650 Moderator on at

    The email address of the corresponding user was not read by the App before it tried to obtain Office365Users.UserPhoto

    Try below (it will change the sequence and your App will have User().Email before it sends a call to UserPhoto action:

    If( 
    !IsBlank(User().Email), 
    Office365Users.UserPhoto(User().Email)
    )

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If this post or my previous reply was useful in other ways, please consider giving it Thumbs Up.

  • nshaw75 Profile Picture
    440 on at

    Hi @happyume , @ahenn22 

    Thanks for the reply guys, I assume that I should copy this into the OnStart property of the app.

  • mmbr1606 Profile Picture
    14,615 Super User 2026 Season 1 on at

    @nshaw75 

     

    if you do this, dont forget to manually run the onstart when testing.

  • nshaw75 Profile Picture
    440 on at

    I have added the text into the OnStart  property and run OnStart. I don't have any errors in the formula in the studio but the error still appears whilst using it via Teams orr my phone. This is my code in he OnStart property

     

    If(
    !IsBlank(User().Email),
    Office365Users.UserPhoto(User().Email)
    );
    Concurrent(
        Set(varUser,User()),
        Set(varUserEmail,User().Email),
        Set(varUserImage,User().Image),
        Set(varUserName,User().FullName)
    )
  • mmbr1606 Profile Picture
    14,615 Super User 2026 Season 1 on at

    did u make sure, that you publish the new version?

  • nshaw75 Profile Picture
    440 on at

    Hi @mmbr1606 

     

    Yeah, I get into the habit of publishing instead of saving when I am in a test scenario like this one. As I can check the UX in reality

     

  • nshaw75 Profile Picture
    440 on at

    I have just noticed that now the error no longer appears on the Home Screen, however, the error is still showing when I navigate to the gallery screen, when in the gallery I have an image of the user which is an entry in a column in the sharepoint list.  Each of the users in the list have a photo attached to their ID. The code I have for the images is Office365Users.UserPhoto(ThisItem.SamplePerson.Email)

  • nshaw75 Profile Picture
    440 on at

    Thanks everybody for the help. i have got the error to disappear definitely not as straightforward as I thought it would be. The formula I used eventually was 

    If(IsBlank(ThisItem.SamplePerson.Email), Icon.Person, If(!IsBlank(ThisItem.SamplePerson.Email), Office365Users.UserPhoto(ThisItem.SamplePerson.Email)))

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard