Microsoft Flow自适应卡可提及团队中的团队用户

时间:2019-06-04 04:33:01

标签: microsoft-teams adaptive-cards microsoft-flow

我正在创建Microsoft流程,以在团队中Flow机器人发布的Adaptive卡中提及用户。

这是我要使用的操作 PostAdaptiveCardAsFlowBot

这是我的JSON的简化版本,

{
   "type": "AdaptiveCard",
   "body": [
      {
        "type": "Container",
        "items": [
            {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "color": "Attention",
                "text": "Hey!"
            },
            {
                "type": "ColumnSet",
                "columns": [
                    {
                        "type": "Column",
                        "items": [
                            {
                                "type": "TextBlock",
                                "text": "<at>steve@example.com</at>",
                            }
                        ],
                        "width": "stretch"
                    }
                ]
            }
        ]
      },
   ],
   "actions": [
      {
        "type": "Action.OpenUrl",
        "title": "Teams Message",
        "url": "-teamsUrl-"
      }
   ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.0"
}

不幸的是,这只是显示为<at>steve@example.com</at>

如果我使用与发送给车队频道的消息相同的语法,则会提及该用户。

PostMessageAsFlowBot

是否可以通过这种方式在自适应卡中提及用户?

1 个答案:

答案 0 :(得分:1)

提及内容仅适用于Adaptive Card,但仅适用于1.2版。

官方文档:Mention support within Adaptive cards v1.2

{
  "version":"1.2",
  "type":"AdaptiveCard",
  "body":[
    {
       "type":"TextBlock",
       "text":"Ahoj <at>Michal Macejko</at>",
       "wrap":True
    }
  ],
  "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
  "msteams":{
    "entities":[
       {
         "additional_properties": {},
         "text": "<at>Michal Macejko</at>",
         "type": "mention",
         "mentioned": 
           {
             "additional_properties": {},
             "id": "channelAccountID",
             "name": "Michal Macejko",
             "aad_object_id": "userID"
           }
       }
    ]
  }
}

aad_object_iduserId的{​​{1}}属性,

https://graph.microsoft.com/v1.0/teams/#{team_id}/members是您应该从SDK get_conversation_member

获取的值

这是一个python示例:

channelAccountID