cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bbsin
Post Prodigy
Post Prodigy

user image - put a generic image??

hi 

 

like to check as some user doesn't put their images in the address book.  there's anyway to show a generic image if there's not user image ?  Thanks

 

 

 

1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @bbsin,

Based on the issue that you mentioned, do you want to display an sample image as the user photo?

Could you please share a bit more about the scenario?

Actually, the screenshot you provided is a standard sample image for the user who does not upload their image. So I do not really know what kind of generic image you want to display for those who doesn't put their images in the address book.

I have a test on my side, please take a try as below.

1). Connect to Office365Users to your app

2). Add an AddPicture button

3). Add an Image control, set Image property as below:

If(
    Office365Users.UserPhotoMetadata(User().Email).HasPhoto = true,
    Office365Users.UserPhoto(User().Email),
    AddMediaButton1.Media
)

Note that if the user does not have upload user image, click the AddMediaButton and upload a normal image as a sample image.

Hope it could help.

Regards,

Qi

View solution in original post

3 REPLIES 3
mate_toth
Advocate I
Advocate I

Hi @bbsin,

One way to achieve this is setting up the image control with the following:

If(
    Office365Users.UserPhotoMetadata(Office365Users.MyProfileV2().id).HasPhoto = true,
    Office365Users.UserPhotoV2(Office365Users.MyProfileV2().id),
    SampleImage
)

The SampleImage can be changed to a generic image you uploaded.

 

I hope this helps. 

v-qiaqi-msft
Community Support
Community Support

Hi @bbsin,

Based on the issue that you mentioned, do you want to display an sample image as the user photo?

Could you please share a bit more about the scenario?

Actually, the screenshot you provided is a standard sample image for the user who does not upload their image. So I do not really know what kind of generic image you want to display for those who doesn't put their images in the address book.

I have a test on my side, please take a try as below.

1). Connect to Office365Users to your app

2). Add an AddPicture button

3). Add an Image control, set Image property as below:

If(
    Office365Users.UserPhotoMetadata(User().Email).HasPhoto = true,
    Office365Users.UserPhoto(User().Email),
    AddMediaButton1.Media
)

Note that if the user does not have upload user image, click the AddMediaButton and upload a normal image as a sample image.

Hope it could help.

Regards,

Qi

View solution in original post

bbsin
Post Prodigy
Post Prodigy

Hi mate_toth,

 

Noted with thanks 🙂

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (51,728)