sharepoint - 通过 webhook 发布到团队时,共享点中托管的图像不显示
问题描述
我正在尝试将我们的一些报告从 slack 迁移到 Microsoft Teams。我们目前正在将图像和 csv 文件从 Azure 函数发布到 slack。
早期我注意到我不能直接发布图片,但我可以在卡片中提及他们的 URL,预览显示并单击它应该会将我带到实际的图片。我开始认为这将非常简单。然后我开始使用 webhooks 选项。唯一的问题是它只支持两种类型的卡片,我几乎无法控制图像大小和其他属性。如果我要使用自适应卡(任何其他卡),那么我将不得不放弃 webhook 并使用我已经开始使用的 Graph API。
然后我开始注意到图像消失了,因为它们不再显示了。我相信这可能是本答案中提到的共享点/团队之间的身份验证问题 - MS Teams 的自适应卡 - 图像显示在 Web 界面而不是桌面应用程序中
浏览器中的团队显示图像,但桌面应用程序不显示。他们也没有在我的团队移动应用程序中显示。
我已经修改了我现有的应用程序以将图像/文件的副本(无论它创建什么)发送到共享点内的文件夹,该文件夹是团队中此通道的后端(使用共享点 API v1)我打算发布缩略图带有指向 Sharepoint 中图像/文件的 url 的卡片。
如果有人可以帮助我解决以下问题,那将真的很有帮助:
- 无论如何要解决 Sharepoint 之间的身份验证问题 ~ Teams
- 发送图像的替代选项,如果 1. 不可行。
请帮忙 :)
编辑:添加卡 JSON:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Sample Heading",
"weight": "bolder",
"size": "medium"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://upload.wikimedia.org/wikipedia/en/e/ea/FlowersForAlgernon.jpg",
"size": "medium"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Report1",
"text": "Matt Hidinger",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "none",
"text": "Created {{DATE(2020-02-14T06:08:39Z,SHORT)}}",
"isSubtle": true,
"wrap": true
}
]
}
]
}
]
}
]
}
解决方案
传入 webhook 现在支持自适应卡片。要使用传入 Webhook 发送自适应卡片,您需要遵循 Bot Activity Message Type 格式:format。您可以在其中将卡片 json 添加到内容字段。
例子:
发布网络挂钩 URL
请求正文:
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Sample Heading",
"weight": "bolder",
"size": "medium"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://upload.wikimedia.org/wikipedia/en/e/ea/FlowersForAlgernon.jpg",
"size": "medium"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Matt Hidinger",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "none",
"text": "Created {{DATE(2020-02-14T06:08:39Z,SHORT)}}",
"isSubtle": true,
"wrap": true
}
]
}
]
}
]
}
]
}
}
]
}
推荐阅读
- ios - HERE MAPS (iOS Swift SDK) 如何识别要加载的 Tile?
- java - Spring Boot SimpleJdbcCall Junit 测试
- c# - GridQueryableCollectionViewWrapper 转换我的字典
到字典 对于 SfDataGrid - elasticsearch - Elasticsearch more_like_this 查询返回具有较高 min_doc_freq 的行但没有具有较低值的行
- reactjs - 在 reactstrap DropdownMenu 中创建一个自定义 div
- javascript - 如何在 javascript 上显示最接近的内容?
- windows - 有没有Win10快捷键可以让鼠标指针回到最后点击的位置?
- c# - 写入现有数据集 hdf5dotnet 的问题
- r - 在 R 中的 for 循环中行绑定数据帧的最快方法?
- google-cloud-platform - 必须使用单一租赁选项,例如来自 Cloud Engine 上操作系统的映像