简体   繁体   中英

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
    }
]
}

根据评论,这是因为图像 Url - 它是 SharePoint Url ,因此在 Web 客户端中静默使用用户登录会话,但在桌面客户端中不这样做。

Yes, When you try to load an image within Adaptive Card using sharepoint url, It uses the accessToken in the images url (which you can see if you try to debug) when you load the adaptive card in Teams Web version with the same user credentails it will work because session But this same behavior will not work with Teams Desktop client. Better to put the images in solution itself and use from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM