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 / Error message displayi...
Power Apps
Answered

Error message displaying the pictures in a gallery when the gallery is empty

(0) ShareShare
ReportReport
Posted on by 1,066

Dear community,

 

I have a Gallery and a TextBox1 for searching. On my gallery template I have an image component which displays

the picture of an employee retrieved by the Office365 connector. My Gallery only displays only the records of employees

when a user specifies his search in the searchbox. So when a user enters his search-criteria it works fine but when the user

empty the searchbox i get an error message in the code of the image:

 

If('Office365-gebruikers'.UserPhotoMetadata(ThisItem.'E-mail').HasPhoto;
'Office365-gebruikers'.UserPhotoV2(ThisItem.'E-mail');
images
)

 

Does anyone know the solution?

Gr. P

 

 

 

 

 

 

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @PeKi72 

     

    May you can do this. Use the system default Sample Image as a place holder if it's blank.

    If(
     'Office365-gebruikers'.UserPhotoMetadata(ThisItem.'E-mail').HasPhoto;
     'Office365-gebruikers'.UserPhotoV2(ThisItem.'E-mail');
     SampleImage
    )

     

  • Verified answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at

    Hi

     

    I'd like to validate. They type in a search, and then the gallery has items in it?

     

    If this code in the Image property of the image? and if its dependent on the Text in the Text Search Box, then you need to wrap this in a check

     

    If(!IsBlank(TextInputForSearch.Text),
     If('Office365-gebruikers'.UserPhotoMetadata(ThisItem.'E-mail').HasPhoto,
     'Office365-gebruikers'.UserPhotoV2(ThisItem.'E-mail'),images
     )
    )

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard