Microsoft Teams Bot 文件卡信息因向频道发送文件信息而损坏

Microsoft Teams Bot file card info is corrupted by sending a file info to a channel

我正在使用 Microsoft Bot Framework 向频道或用户发送文件卡片, 但是好像文件卡的格式不正确...无法点击文件卡或打开文件...

我如何生成卡片:

FileInfoCard card = new FileInfoCard()
    {
        FileType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
        UniqueId = driveItemUniqueId,
    };

    Attachment att = card.ToAttachment();
    att.ContentUrl = fileLocation;
    att.Name = fileName;


    replyToConversation.Attachments.Add(att);
    return replyToConversation;

将发送给团队的 json 代码如下:

[{
"contentType": "application/vnd.microsoft.teams.card.file.info",
"contentUrl": "https://fileLocation.com/xyz",
"content": {
    "uniqueId": "jfölasjflasjföiu289u9o2or2jor2l1ö1l3jrlö12j4l",
    "fileType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "etag": null
},
"name": "Meeting Minutes - testmeeting 2 fso - 26-1-2019.docx",
"thumbnailUrl": null

}]

该主题的 Microsoft 资源: https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bots-files

用下面的例子:

    {
  "attachments": [{
    "contentType": "application/vnd.microsoft.teams.card.file.info",
    "contentUrl": "https://contoso.sharepoint.com/personal/johnadams_contoso_com/Documents/Applications/file_example.txt",
    "name": "file_example.txt",
    "content": {
      "uniqueId": "1150D938-8870-4044-9F2C-5BBDEBA70C8C",
      "fileType": "txt",
    }
  }]
}

编辑:附加信息。 我不确定 uniqueId 是否正确。 word 文件被上传到 SharePoint 站点。此 UniqueId 看起来不像示例中的唯一 GUID...在团队 iOS 应用程序中,我可以单击 link,但会出现一条消息,指出无法访问此文件。

编辑:唯一 ID 已修复,但问题仍然出现在 MS Teams 桌面客户端上。 我已经用我从图表 API 获得的文件中的 Ctag 中的 GUID 替换了唯一 ID。在 iOs 应用程序上它现在可以工作,但在桌面客户端上,仍然有红色三角形。

Iphone 上的按钮:

请将文件类型设置为 docx,如下所示:

        FileInfoCard card = new FileInfoCard()
        {
            FileType = "docx",
            UniqueId = Guid.NewGuid().ToString() // unique id.
        };

        Attachment att = card.ToAttachment();
        att.ContentUrl = contentUrl;
        att.Name = name;