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 / Office 365 user image ...
Power Apps
Answered

Office 365 user image on Gallery - Error when app is published

(0) ShareShare
ReportReport
Posted on by 9

Hi everyone

 

New to powerapps but slowly learning everything I can at a snails pace. I have a canvas app that connects to two SharePoint lists and also utilizes the Office 365 users connector. the gallery for office 365 users works and shows me all my users that are enabled. I wanted to show my user's profile picture on the image section of the gallery and if they do not have a profile pictures show a 'place holder' image. 

 

I found a nifty youtube video which helped me a lot as I was struggling to get a placeholder image to work. So I used the function from that video which worked a treat and can now see a placeholder image where needed against users who do not have one. 

Now when I am editing the app everything looks fine I do not get any red 'x's for my formulas and when 'Playing' the app everything works fine. 

 

However, when publishing the app I want to search my office 365 users or load the page where the gallery is located. I get an error message for office365user.photmetadata - 'user ID', which for the life of me I can't figure out how to resolve. I've looked through most of the forums and some people have come up with ways to resolve but nothing works for me. 

 

Maybe someone will spot what I am doing wrong as I can not see what

 

The image formula is here: 

With(
{
personImage: Office365Users.UserPhotoV2(ThisItem.Mail),
hasphoto: Office365Users.UserPhotoMetadata(ThisItem.UserPrincipalName).HasPhoto
},
If(
hasphoto,
personImage,
Office365User  <Name for my placeholder image)
)
)

 

TechOLab_0-1662737669503.png

 

 

TechOLab_1-1662737758830.png

 

 

Categories:
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    Hello, @TechOLab , what is your ThisItem.UserPrincipalName? Note UPN is an Azure AD and has specific format.

     

     

    If my reply helped you, please give a 👍 , & if it solved your issue, please 👍 & Accept it as the Solution to help other community members find it more.


    I am primarily available on weekdays from 6-10 PM CT and 5-10 PM CT on weekends.


    Visit my Blog: www.powerplatformplace.com


     

     

  • TechOLab Profile Picture
    9 on at

    Hi @AhmedSalih,

    my thought was the 'ThisItem.UserPrincipalName' would pass in the UPN of the user from Azure AD in the gallery.  So each time the app would load it would check to see if the user based on the account UPN has an image?

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @TechOLab , add a label to your Gallery and put this in its Text property: ThisItem.UserPrincipalName

    Let me know what you get

  • TechOLab Profile Picture
    9 on at

    @AhmedSalih, 

     

    I added a Label with with the text property you suggested. Published and get below: 

     

    TechOLab_0-1662739867678.png

     

  • Verified answer
    AhmedSalih Profile Picture
    6,680 Moderator on at

    @TechOLab , okay, now try this:

    With(
    {
    personImage: Office365Users.UserPhotoV2(ThisItem.Mail),
    hasphoto: Office365Users.UserPhotoMetadata(ThisItem.UserPrincipalName).HasPhoto
    },
    If( 
    !IsBlank(ThisItem.UserPrincipalName) && hasphoto,
    personImage,
    Office365User  <Name for my placeholder image)
    )
    )

     

     

    If my reply helped you, please give a 👍 , & if it solved your issue, please 👍 & Accept it as the Solution to help other community members find it more.


    I am primarily available on weekdays from 6-10 PM CT and 5-10 PM CT on weekends.


    Visit my Blog: www.powerplatformplace.com


     

     

  • TechOLab Profile Picture
    9 on at

    @AhmedSalih, you've only gone and done it mate. That worked a treat!

    Thank you

     

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @TechOLab, Happy to help 🙂

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard