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 / Office365Users.UserPho...
Power Apps
Unanswered

Office365Users.UserPhoto error

(0) ShareShare
ReportReport
Posted on by 565

Hi everyone,

 

I do not know why this error message appears.

I am checking that the email address is not empty and besides the photo of the user is showing correctly.

 

photo.png

 

This is the formula to get the picture:

 

If(
!IsBlank(CurrentUserEmail.Text)
And Office365Users.UserPhotoMetadata(CurrentUserEmail.Text).HasPhoto,
Office365Users.UserPhotoV2(CurrentUserEmail.Text)
)

 

In the Powerapps designer the error is not showing.

 

Thanks for any help!

Categories:
I have the same question (0)
  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @EmilioRoqueta69 ,

    May be something like would help:

    If(
    IsBlank(CurrentUserEmail.Text),
     Blank(),
     If(
     Office365Users.UserPhotoMetadata(CurrentUserEmail.Text).HasPhoto,
     Office365Users.UserPhotoV2(CurrentUserEmail.Text),
     Blank()
     )
    )
  • EmilioRoqueta69 Profile Picture
    565 on at

    Hi, 

     

    The picture still showing but the error persists:

     

    Office365Users.UserProfile failed: The function 'UserProfile' 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.

  • cdwhite Profile Picture
    1,067 Most Valuable Professional on at

    Hi @EmilioRoqueta69 ,

    The API to get user images can be funny, as it can ping constantly and sometimes return errors needlessly.

    There is a way around it, but it's a preview feature. These aren't recommended for use in production apps, however in my experience this is one of the few you can enable and use with confidence.

    Firstly, go to Settings in the designer and enable Formula Level Error Management:

    cdwhite_0-1693491421354.png


    In your image control, you can then add the following Power Fx to the image property:

     

    IfError(
     Office365Users.UserPhotoV2(CurrentUserEmail.Text),
     Blank()
    )

     

     

    I've replicated this at my end and no error message is returned. Have a go and see if this will work for you.

    For more info on the error functions, please refer to this MS article.

    ------------------------------------------------------------------------------------------------------------------------------
    If I've answered your question, please mark your post as Solved. You can accept more than one post as a solution.

    If my response was a good one, please give it a Thumbs Up!

    Visit my blog: https://platformsofpower.net

  • EmilioRoqueta69 Profile Picture
    565 on at

    Hi,

     

    Thank you for your help.

    The error message still remains...

    But the picture is loading fine always.

     

    I made some changes to my formula in order to show an icon if it is empty.

     

    If(
    IsBlank(Office365Users.UserProfile(CurrentUserEmail.Text).Id),
    Icon.Person,
    If(
    Office365Users.UserPhotoMetadata(Office365Users.UserProfile(CurrentUserEmail.Text).Id).HasPhoto = true,
    Office365Users.UserPhoto(Office365Users.UserProfile(CurrentUserEmail.Text).Id),
    Icon.Person
    )
    )

     

  • EmilioRoqueta69 Profile Picture
    565 on at

    I am using power apps inside Teams, may be it is a bug.

    Please can you see if your solution works there?

    Thanks in advance!

  • Verified answer
    EmilioRoqueta69 Profile Picture
    565 on at

    I solved this issue without enabling Formula Level Error Management.

    Using this formula:

     

    If(
    !IsBlank(CurrentUserEmail.Text)
    And Office365Users.UserPhotoMetadata(CurrentUserEmail.Text).HasPhoto,
    Office365Users.UserPhotoV2(CurrentUserEmail.Text)
    )

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard