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 / Getting Error when acc...
Power Apps
Unanswered

Getting Error when accessing user photos

(0) ShareShare
ReportReport
Posted on by 89

Hi,

 

I created an application showing up the profile pic of employees.

The image property is the following:

If(Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto,Office365Users.UserPhoto(Id),profile)

 

For entries having a profile picture everything's fine. If a user has no photo the default image "profile" is being displayed.

However I see the little error mark saying:


ErrorUserPhoto.gif

 

When I view the app within the browser I don't see the red error bar on top.

But when launching the app on a mobile device/iPad I get an error for each user without a profile picture (but the placeholder picture is being displayed)

Categories:
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @stefansc,

     

    To display Office 365 profile pictures without throwing errors,  you need to do several checks ahead of time.

     

    1. Check to see if the user has an Id
    2. Check to see if the user is an external user by inspecting the domain for their email account
    3. Check to see if the user has a profile picture
    4. If any of the checks fail, display a placeholder image
    5. If all of the checks pass, call Office365Users.UserPhoto to return the photo and display it

    Please use below formula instead:

    If(
     IsBlank(ThisItem.Id),
     'profilepic-generic-user',
     If(
     Not(UserDomain.Text = MyDomain),
     'profilepic-generic-user',
     (
     If(
     Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto = true,
     Office365Users.UserPhoto(ThisItem.Id),
     'profilepic-generic-user')
     )
     )
     )

    Regards,

    Mona

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard