MS Teams自适应卡片复制链接异常:复制帖子链接而非目标链接
解决Teams私有频道Adaptive Card链接复制异常问题
问题现象
通过Azure Logic App发布到MS Teams私有频道的Adaptive Card中,使用TextBlock的Markdown格式链接时,点击可正常跳转至目标地址,但右键复制链接时,得到的是Teams帖子的链接而非目标链接。
原因分析
TextBlock中的Markdown链接会被Teams内部渲染为嵌套在帖子上下文的链接,右键复制时系统会优先捕获Teams帖子的跳转链接,而非原始目标URL。
解决方案
将TextBlock中的Markdown链接替换为Adaptive Card原生的Action.OpenUrl组件,该组件直接绑定目标URL,右键复制时可正确获取原始链接。
修改后的Adaptive Card JSON代码
{ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.6", "msteams": { "width": "Full" }, "body": [ { "type": "Container", "width": "500px", "items": [ { "type": "Container", "width": "1200px", "items": [ { "type": "TextBlock", "text": "Adaptive card example", "weight": "Bolder", "size": "Medium", "wrap": true, "spacing": "None" } ], "verticalContentAlignment": "Top" }, { "type": "FactSet", "width": "1200px", "facts": [ { "title": "User ID", "value": "1234" }, { "title": "Username", "value": "xyz" } ] }, { "type": "TextBlock", "text": "**Test Link**", "wrap": true }, { "type": "ActionSet", "actions": [ { "type": "Action.OpenUrl", "title": "Here is the link", "url": "https://www.google.com/" } ] } ], "style": "emphasis", "horizontalAlignment": "Left" } ] }
说明
- 使用
Action.OpenUrl组件后,链接默认以按钮样式展示,右键复制时将直接获取目标URL;若需贴近文本链接的视觉效果,可通过调整组件的style属性或结合Teams扩展配置优化。 - 该方案适配Teams私有频道场景,同时兼容公开频道的Adaptive Card链接需求。
内容的提问来源于stack exchange,提问作者Mamta Patil
相关产品推荐
相关产品推荐

