cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GRAEMEJOHNSON
New Member

Including a user photo in an Adaptive Card

Hi

As a proof of concept, I'm trying to build a flow that will post an adaptive card to a Teams channel with my profile mugshot in the message body.

The only components I can find to return my profile image, return the raw content, rather than a URL....is there a way to get this working?

 

2019-03-22_15h28_44.png

 

42 REPLIES 42

Thanks Fraser! Was stuck in this for a long while now. Your answer really helped. This idea worked, I just had to change

 

 

"url": "data&#58image/png;base64,@{outputs('Compose')}",

 

 

 to 

 

 

"url": "data:image/jpeg;base64,@{outputs('Compose')}",

 

 

and it worked fine for me. I wanted to use user profile image in adaptive card(to be displayed on Outlook app) and was able to achieve that.

Adarsh2199_0-1603802471595.png

This worked perfectly for me, thank you!

Thwatered
New Member

None of the prior options worked for me. I think due to 302 redirect errors in the 'Send a HTTP Request to Sharepoint' action. The response didn't return any redirected location so I was stuck.

 

"https://teams.microsoft.com/api/mt/apac/beta/users/8:orgid:<user ID>/profilepicturev2?displayname=<display name>&size=HR96x96"

 

What worked for me was to construct the above URL used by Teams for user photos. This includes a user ID (e.g. '3666e81d-07ba-628e-b633-51db53a564c3') that I noticed was included in the output from 'List group members'. Filter this output by 'User Principal Name' = email address of the user (case-sensitive so I used toLower()) to find the relevant member.

toLower(triggerOutputs()?['body/Assigned/Email'])

Thwatered_0-1639438976952.png

in the adaptive card, the user picture is posted via:

Thwatered_1-1639439206068.png

{
"type": "Image",
"style": "Person",
"size": "Small",
"url": "https://teams.microsoft.com/api/mt/apac/beta/users/8:orgid:@{items('Apply_to_each')?['id']}/profilepicturev2?displayname=@{items('Apply_to_each')?['displayName']}&size=HR96x96"
}
Apply to each loop should only have one iteration due to the filter. You could avoid this by writing the filter outputs to variables.
 
When checking, these 96x96 images are only ~9 kB. Thankfully below the 28 kB limit.
 
Edit: also, you may need to edit 'apac' to suit your region if not in Asia Pacific.

 

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,348)