Search code examples
microsoft-teamsadaptive-cardsmicrosoft-graph-teams

Adaptive cards for MS Teams - images displaying in web interface but not desktop application


I have a recurring issue with teams and adaptive cards. It doesn't seem to matter if I post a card from the Flow post an adaptive card connector or from the graph API directly, the images in my cards display in the teams web browser interface but not in the desktop application.

Apart from that the card displays ok, just no image rendering in desktop. Tough one to debug as it's working ok in chrome, if there a way to look at the desktop apps source code to see if that img url is being prefixed or replaced or something down those lines.

Curious thing is I've seen a couple of videos of it working for others but. Here's my card code within the Graph API body JSON...

{
"subject": null,
"body": {
    "contentType": "html",
    "content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>"
},
"attachments": [
    {
        "id": "74d20c7f34aa4a7fb74e2b30004247c5",
        "contentType": "application/vnd.microsoft.card.adaptive",
        "contentUrl": null,
        "content": "{ \"type\": \"AdaptiveCard\", \"body\": [ { 
        \"type\": \"TextBlock\",
        \"size\": \"Medium\",
        \"weight\": \"Bolder\",
        \"text\": \"Hello andy\"
    },
    {
        \"type\": \"Image\",
        \"altText\": \"\",
        \"url\": \"https://companyname.sharepoint.com/sites/TeamsDev/ImageLib/imagebname.jpg\"
    }
],
\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",
\"version\": \"1.0\"
}",
        "name": null,
        "thumbnailUrl": null
    }
]
}

Solution

  • As per comments, this was because of the image Url - it's a SharePoint Url , so silently uses the users login session in the web client, but doesn't do the same in the desktop client.