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 / Officeo365Users.UserPh...
Power Apps
Unanswered

Officeo365Users.UserPhoto / UserPhotoMetadata Error

(0) ShareShare
ReportReport
Posted on by 160

Hi, 

I cant seem to be able to work around an error that is received for the o365Users.UserPhoto data when an account is not active anymore. This is the syntax that I'm using:

 

If(!IsBlank(ThisItem.EmployeeEmail) && Office365Users.UserPhotoMetadata(ThisItem.EmployeeEmail).HasPhoto = true, Office365Users.UserPhoto(ThisItem.EmployeeEmail),'defaultimage')

 

I tried adding the .HasPhoto check but that also receives the error: Status 404 No user found with the specified id. 

 

Does anyone have any solutions or work arounds? 

Categories:
I have the same question (0)
  • Brian Dang Profile Picture
    3,976 on at

    Hi @nbarsley1,

    It looks like you've wrapped a condition around Office365Users.UserPhoto to avoid a situation where the user account is inactive or they do not have a photo, but it is still receiving a Status 404 error with the ID.

     

    I've formatted your formula below to understand it better:

     

    If(!IsBlank(ThisItem.EmployeeEmail) && 
     Office365Users.UserPhotoMetadata(ThisItem.EmployeeEmail).HasPhoto = true, 
    
     Office365Users.UserPhoto(ThisItem.EmployeeEmail),
    
     'defaultimage'
    )

     

    There's two things I'd like you to try:

    • Can you try UserPhotoV2 instead of UserPhoto?
    • Instead of EmployeeEmail, can you reference the user's Id?

    The result of these changes will look like this:

     

    If(!IsBlank(ThisItem.EmployeeEmail) && 
     Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto = true, 
    
     Office365Users.UserPhotoV2(ThisItem.Id),
    
     'defaultimage'
    )

     

    Let me know what the result is.

     

    Mr. Dang

    ________

  • nbarsley1 Profile Picture
    160 on at

    Hi, 

    Thanks for the quick response. Unfortunately I have to use EmployeeEmail because we are not saving the employee's ID to our database. 

    Changing the formula to use UserPhotoV2 didnt cause any problems but we still have an issue with UserPhotoMetaData returning an error. If I take out the UserPhotoMetaData check then the UserPhotoV2 returns an error. 

  • Brian Dang Profile Picture
    3,976 on at

     

    Ah, so to clarify, you just need to avoid using the function if the user does not exist. I would use a condition where you check if the user is 'in' a gallery or collection that has all the users:

     

    If(ThisItem.EmployeeEmail exactin Gallery1.EmployeeEmail, show this picture, else show default image)

     

    Let me know how that turns out.

     

    Mr. Dang

    _______

  • nbarsley1 Profile Picture
    160 on at

    No sorry maybe I wasn't clear. 

     

    If a user does not exist in AD I receive an error trying to view their user photo. I have tried a few things to not receive the error, but am unable to catch the error. 

     

  • JimmyW Profile Picture
    2,567 on at

    @nbarsley1 Did you solve this? I have the same issue.

     

    If(
    !IsBlank(ThisItem.'Requested By'.Email),
    If(
    Office365Users.UserPhotoMetadata(ThisItem.'Requested By'.Email).HasPhoto,
    Office365Users.UserPhotoV2(ThisItem.'Requested By'.Email),
    SampleImage
    ),
    SampleImage
    )

    If the user have been deleted then it will show an error message

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 136 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard