cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GRAEMEJOHNSON
Level: Power Up

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

 

20 REPLIES 20
Super User
Super User

Re: Including a user photo in an Adaptive Card

Hi @GRAEMEJOHNSON , thank you for your post.

I have had a fair crack at this, I have it posting images but you won't be able to use "Get user photo (V2)". The output from that is the actual file, not a URL to a file.

 

So, to get this to work, some information on this post will be helful to you - https://sharepoint.handsontek.net/2018/10/05/how-to-get-sharepoint-profile-picture/

 

I have got it working with Graph and Delve Urls although an option could be to get the photo in the way you have, save it to SharePoint or OneDrive then call back it's Url in that way. There is a create sharing link action that will do this when in SharePoint.

 

There's a few ways to go at it but it will need to be a url that you use in your JSON for the adaptive card.

 

If you have found my post helpful, please mark thumbs up.

Any other questions, just ask.

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


GRAEMEJOHNSON
Level: Power Up

Re: Including a user photo in an Adaptive Card

Well....I got this working by adding a Compose action to Base64 encode the binary image data....

 

2019-03-25_15h30_04.png

 

...then within the message body of the adaptive card, reference the Output within a 'Data' tag....

 

2019-03-25_15h31_49.png

Highlighted
GRAEMEJOHNSON
Level: Power Up

Re: Including a user photo in an Adaptive Card

2019-03-25_15h33_45.png

This is the end result

 

However - with other user's profile pictures it does not work!  Don't know whether it's down to some limit on the size of an adaptive card payload?

 

 

{
"error": {
"code": "MissingOrInvalidBotAdaptiveCardRequest",
"message": "The specified Teams flowbot adaptive card request is missing or invalid."
}
}
Super User
Super User

Re: Including a user photo in an Adaptive Card

Hi Graeme.
That’s a nice solution you’ve found there. I wasn’t aware of the whole data:image parameters so glad you had shared this and I’ll be looking at the docs on that for future.

Thanks, Alan.

Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


BrendanMurphy
Level: Powered On

Re: Including a user photo in an Adaptive Card

I was able to use this url to get the picture.  You can adjust the size using S, M, or L

Compose_String_Profile_Picture.png

 

geraldclerc
Level: Powered On

Re: Including a user photo in an Adaptive Card

Hi Brendan

 

Your solution does not work for me at this time.

I do not get any errors in Flow but the image is not shown in the adaptive card.

If i put the image url in a browser i can download the jpg image.

Any idea?

Gerald

BrendanMurphy
Level: Powered On

Re: Including a user photo in an Adaptive Card

@geraldclerc , I noticed that the pictures from the adaptive cards I had created previously are now mysteriously gone.  I'm guessing MS changed something that broke it.  I don't have another solution at this point. 

mlamontagne
Level: Powered On

Re: Including a user photo in an Adaptive Card

The 'Get user photo (V2)' and 'base64' encoding is working for me for any user's photo in adaptive cards but the SharePoint profile url is not.

user photo.jpg

Dudditz
Level 8

Re: Including a user photo in an Adaptive Card

I tried using all mothods posted here, sharepoint URL just displays blanks and the method Grmae posted using the base64conversion and the flow fails with the follwoing error.

 

The specified Teams flowbot adaptive card request is missing or invalid.

 

We really need to get this working for a varieity of Adaptive cards we are building.  Any guidance is appreciated.

 

1.jpg2.jpg3.jpg

Dudditz
Level 8

Re: Including a user photo in an Adaptive Card

Worked by using the delve URL in the URL field


"/youro365domain/_vti_bin/DelveApi.ashx/people/profileimage?size=L&userId="

BrendanMurphy
Level: Powered On

Re: Including a user photo in an Adaptive Card

Thanks @Dudditz This worked for me as well.  My SharePoint url broke a few months ago and haven't been able to fix it till now.  

Dudditz
Level 8

Re: Including a user photo in an Adaptive Card

Is this still working for you?  All my images in adaptive cards are no longer working using this.  Seems silly how much screwing around this is to get an image to work.

 

/youro365domain/_vti_bin/DelveApi.ashx/people/profileimage?size=L&userId=

 

Dudditz
Level 8

Re: Including a user photo in an Adaptive Card

At this point I would love to see some documentation or some clear direction on the proper method to include an employee image from either delve, sharepoint, graph, etc.  I really don't care where it comes from, simply want to see it work.

 

Both sharepoint and delve have worked and now neither are working.  

BrendanMurphy
Level: Powered On

Re: Including a user photo in an Adaptive Card

No, not working anymore for me either.  Smiley Sad

Dudditz
Level 8

Re: Including a user photo in an Adaptive Card

I figured that, it would be great if someone could chime in here and provide some direction on the proper way to display an employee photo on an adaptive card.  I have tried every method in the post below and none of them work, some of them worked just a few weeks ago and now they all display the default no image icon.

 

 https://sharepoint.handsontek.net/2018/10/05/how-to-get-sharepoint-profile-picture/

mcorlou
Level: Power Up

Re: Including a user photo in an Adaptive Card

Hello,

 

Facing this problem today, solved using this url : https://teams.microsoft.com/api/mt/emea/beta/users/<user mail>/profilepicturev2?displayname=<user diplay name>&voidCache=false

 

Replace bold sentences by your parameter and boom its' done !

 

Here code

 

SharedScreenshot2.jpg

 

Here results

 

SharedScreenshot.jpg

Dudditz
Level 8

Re: Including a user photo in an Adaptive Card

mcorlou that's an interesting way to do it.  Not sure what the correct URL would be for NA?  Seems strange that method requires more than simply the email and also the display name.  Could you please confirm this method actually displays the image in both the teams client and web version? 

 

I just realized the previous method I have been using has been working all along however only in the web version of teams.  Where most if not all versions stopped working is within the Teams client.

 

This is the method I am currently using works only in the web version and not the Teams client.

https://yourdomain/_vti_bin/DelveApi.ashx/people/profileimage?size=L&userId=emailaddress

mgertz
Level: Powered On

Re: Including a user photo in an Adaptive Card

I'm having the same issue with profile pic, but I'm also curious if anyone is able to see any images posted to SharePoint in the Teams desktop client.

 

I created a quick Power App that takes a photo and passes it to Flow which (does some other stuff) and eventually posts an adaptive card to Teams. I'd like to store the image in the Teams SharePoint site, but no matter what I try, I can't get it to render in the Teams client. 

 

When I post the card as the Flow Bot, the Image renders perfectly in the web version of Teams, but is completely ignored by the Teams Desktop Client. The only time I can get the Teams Desktop Client to admit that there could be an image to display is if I change the size from Auto to Small, Medium, Large, etc. It won't display the image, but at least it displays a placeholder.

 

Other relevant facts... 

  • Teams Client has no problem rendering a static map from a Google Maps URL in the card
  • Teams Client has no problem rendering the image in the card when I store it in/retrieve it from Imgur
  • I've also added a button ("View full image") that opens the image from SharePoint in a browser using the exact same URL as the destination for a button in the card

Am I crazy, or does this seem like some kind of a permission issue with the Teams client and images that require authentication?

cn
Level: Powered On

Re: Including a user photo in an Adaptive Card

I am trying something compareable, but not with a profile picture, but with a picture attached to a list-item.

I can include any public picture, but not the one stored in my sharepoint list which i access in the Flow.

So it seems the adaptive card, that is not send by the user itself, but as a flow-bot does not have the permisson.

 

It would be great if this could be confirmed and of course it would be great if there is any solution.

I can delete that attachment or send it to someone else by mail... wo why not send it as the flow-bot.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,245)