【问题标题】:Opening Task module from Adaptive Card using Action.OpenUrl使用Action.OpenURL从Adaptive卡打开任务模块
【发布时间】:2019-09-28 05:22:02
【问题描述】:

我们正在使用以下 Graph API https://docs.microsoft.com/en-us/graph/api/channel-post-chatmessage?view=graph-rest-beta&tabs=cs

在频道中发布自适应卡片

我们的有效载荷是

{
  "body":{
    "contentType":"html",
    "content":"<attachment id="attachmentId"></attachment>"  // for attachmentId see attachments section below
  },
  "attachments":[
    {
      "id":"attachmentId",
      "content":cardData // this is JSON.stringify of actual Adaptive card data 
    }
  ]
}

我们的自适应卡片也像

{
  "type":"AdaptiveCard",
  "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
  "body":"some body",
  "actions":[
    {
       "type":"Action.OpenUrl",
       "title":"Suggest Item",
       "url":"https://teams.microsoft.com/l/task/2a05d07c-d194-400e-8122-cad64cfe1cef?url=https%3A%2F%2Flocalhost%3A44349%2Fteams%2F%23%2Fsuggest%2Fee31b3aa-f60f-4594-a964-a01fcc461ceb%3Ffrom%3Dcard&height=540&width=800&title=*Suggest%20item"
    }
  ]
}

如果我在聊天中发布任务模块网址并单击它可以工作, 但它不适用于 Adaptive Card Action.OpenUrl 以前它曾经工作过

【问题讨论】:

  • 我的网址中有一个*,所以链接不起作用

标签: microsoft-graph-api microsoft-teams adaptive-cards


【解决方案1】:

任务模块深层链接在自适应卡片 OpenUrl 中运行良好。您能否尝试以下 JSON 有效负载?

{
             "body": {
                "contentType": "html",
                "content": "<attachment id=\"fa74618d23064677a1af25d0ae973532\"></attachment>"
            },
            "attachments": [
                {
                    "id": "fa74618d23064677a1af25d0ae973532",
                    "contentType": "application/vnd.microsoft.card.adaptive",
                    "content": "{\r\n    \"type\": \"AdaptiveCard\",\r\n    \"actions\": [\r\n        {\r\n            \"type\": \"Action.OpenUrl\",\r\n            \"title\": \"View\",\r\n            \"url\": \"https:\/\/teams.microsoft.com\/l\/task\/f195eed2-4336-4c33-a11b-a417dcaa8680?url=https:\/\/taskmoduletest.azurewebsites.net\/customform&height=430&width=510&title=Custom%20Form&fallbackUrl=https:\/\/taskmoduletest.azurewebsites.net\/customform\"\r\n        }\r\n    ],\r\n    \"$schema\": \"http:\/\/adaptivecards.io\/schemas\/adaptive-card.json\",\r\n    \"version\": \"1.0\"\r\n}"
                }
            ]
}

如果您遇到任何问题,请告诉我们。

【讨论】:

    【解决方案2】:

    在我的标题网址中有一个*,删除后它再次起作用

    【讨论】:

      猜你喜欢
      • 2020-03-16
      • 2021-12-03
      • 2021-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-17
      • 1970-01-01
      • 2021-03-23
      相关资源
      最近更新 更多