cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Memorable Member
Memorable Member

Get User Photo V2 (If blank content is returned how to set sampleimage)

Hi i have a flow that extracts the users image and then uses the content output in an adaptivecard to display the users image. Now i found some users don't have an image set so the content returns blank.

 

How can i set a sampleimage to refer to is the users image is blank?

I use Base64 and compose the image content.

 

Is there a way for me to use set a sampleimage in Base64?

1 ACCEPTED SOLUTION

Accepted Solutions

@Sim2KUK 
You might need to change Microsoft365User to Office365User

If(
!IsBlank(ThisItem.'Created By'.Email),
If(
Microsoft365Users.UserPhotoMetadata(ThisItem.'Created By'.Email).HasPhoto,
Microsoft365Users.UserPhotoV2(ThisItem.'Created By'.Email),
SampleImage
),
SampleImage
)

 

 

View solution in original post

7 REPLIES 7
JimmyWork
Memorable Member
Memorable Member

Bump.

Anyone, how do you handle blank User Photo? My flow stops due to compose is empty. So i need a condition if User Photo content = null.

 

Should just create a blank user with photo and fetch that?

Bump

chico
Advocate V
Advocate V

+1 

also looking at options on how to filter out those that dont have a photo.

chico
Advocate V
Advocate V

actually just stumbled across something that may help,

the get user metadata will tag "true" if user has a photo, so in my case I just tossed a condition looking for the "true" value.

Paulie78
Super User
Super User

In answer to your initial question, it would certainly be possible to use a sample image. But I guess you don't need it anymore?

Sim2KUK
Frequent Visitor

That's great. Would be nice to see the actual code you used to help out others as well.

@Sim2KUK 
You might need to change Microsoft365User to Office365User

If(
!IsBlank(ThisItem.'Created By'.Email),
If(
Microsoft365Users.UserPhotoMetadata(ThisItem.'Created By'.Email).HasPhoto,
Microsoft365Users.UserPhotoV2(ThisItem.'Created By'.Email),
SampleImage
),
SampleImage
)

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,805)