使用 Action.OpenUrl 从 Adaptive Card 打开任务模块
Opening Task module from Adaptive Card using Action.OpenUrl
我们正在 post使用以下 图表 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"
}
]
}
如果我 post 任务模块 Url 在聊天中点击它就可以了,
但它不适用于 Adaptive Card Action.OpenUrl
以前它曾经工作
任务模块深度 link 在自适应卡片 OpenUrl 中工作正常。你能试试下面的 JSON payload 吗?
{
"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}"
}
]
}
如果您遇到任何问题,请告诉我们。
我的 url 中有一个 *
作为标题,删除后又可以使用了
我们正在 post使用以下 图表 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"
}
]
}
如果我 post 任务模块 Url 在聊天中点击它就可以了,
但它不适用于 Adaptive Card Action.OpenUrl
以前它曾经工作
任务模块深度 link 在自适应卡片 OpenUrl 中工作正常。你能试试下面的 JSON payload 吗?
{
"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}"
}
]
}
如果您遇到任何问题,请告诉我们。
我的 url 中有一个 *
作为标题,删除后又可以使用了