Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

How to Validate user image if no image displayed in gallery show other image ?

Hi All


I m trying validate the filed Image in Gallery, which I did figure out how to do it in certain ways, but it shows and error while running the app saying invalid userid  I do not know whats the error actually for as the Id which I have passed is the email ID only and still showing the error as follows:


Any leads on this error experts/. 

Please see that I used the formula something like this in Gallery Image. 
ON image: 


 If(Office365Users.UserPhotoMetadata(ThisItem.'Created By'.Email).HasPhoto ,  ThisItem.'Created By'.Picture , 'collaboration-female-male' )


Please note  I also tried below formula as suggested in one of the article and solutions on PowerApps Community but did not seems to be working fine for me. 


If(!IsBlank(ThisItem.'Created By'.Email), If(Office365Users.UserPhotoMetadata(ThisItem.'Created By'.Email).HasPhoto ,  ThisItem.'Created By'.Picture , 'collaboration-female-male' ))





If(!IsBlank(Text(ThisItem.'Created By'.Email)), If(Office365Users.UserPhotoMetadata(Text(ThisItem.'Created By'.Email)).HasPhoto ,  ThisItem.'Created By'.Picture , 'collaboration-female-male' ))




Thank you for helping on, much appreciated your time and efforts 

Thanks a million.

Resident Rockstar
Resident Rockstar

A few observations/questions:

  • Is this on CDS? Assuming yes, since you're using 'Created By' and expanding the relationship
  • You are mixing two data sources
    • The Office365Users object may have an image for the user
    • The CDS User record may have an image for the user
    • These are not the same thing, and they are not synchronized
      • Are you intending to show the CDS image?
      • If so, check for the CDS image instead of the Office365 image
  • Consider a layering approach instead
    • Simply put the stock image behind the user image
      • Same sizes, or at least to avoid overlaps
    • Set the user image more generically
      • Office365Users.UserPhoto_V2 ( ThisItem.'Created By'.'User Name' )
    • This way, if it resolves an image, it will overlay the stock image automatically
    • In experiences the Office365Users connector will return a non-blank (but empty/transparent) image if they don't have a picture setup

Hello @GarethPrisk , 

Thank you so much for your quick response, would like to inform you that I'm using my Sharepoint as Datasource, and hence the filed I have used in is Created by as you see in post. 

Also AS per your suggestion I tried using set Variable if im not mistaken but still it shows an error and not accepting the formula. 

Can you please give me an example if im wrong would help me a lot sir. 

Thanks a million


Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (953)