使用 smba trafficmanager 或 botframework 发送 pdf

Send pdf with smba trafficmanager or botframework

我正在尝试使用 https://smba.trafficmanager.net/in/v3/conversations/ 将 pdf 文件作为附件主动发送给团队用户,附件格式如下

"attachments": [
        {
            "contentType": "application/pdf",
            "contentUrl": "http://www.africau.edu/images/default/sample.pdf",
            "name": "sample.pdf",
            "content": {
                "uniqueId": "1150D938-8870-4044-9F2C-1213213123",
                "fileType": "pdf"
            }
        }
    ]

我每次收到时都能发送 txt 文件,但不能发送 pdf 文件

{"error":{"code":"BadArgument","message":"Unknown attachment type"}}

除了application/pdf还有其他内容类型吗?

我同意 Hilton 和 Dev 的观点。我认为使用 Microsoft Graph API post 带有引用现有 SharePoint 文件的卡片附件的消息更方便。

MS documents提到了机器人发送附件的两种方式。 使用 Microsoft Graph API 适用于 Teams 中所有范围内的机器人,而使用 Teams API 仅适用于个人环境。

顺便说一下,文档说 pdf 可以作为一种文件类型。

@kiran,下面的有效负载对我有用。因此,为了您的方便,我添加了有效负载(如下),以便您可以 copy/test 它。

{ "body": { "contentType": "html", "content": "Here's the latest budget. <attachment id=\"153fa47d-18c9-4179-be08-9879815a9f90\"></attachment>" }, "attachments": [ { "id": "153fa47d-18c9-4179-be08-9879815a9f90", "contentType": "reference", "contentUrl": "m365x987948.sharepoint.com/sites/test/Shared%20Documents/…", "name": "Budget.pdf" } ] }

根据评论中的讨论,最好为托管在 SharePoint(文件选项卡)中的文档提供 link - 这正是“文件”选项卡的用途,而不是每个用户都必须下载自己的副本。另外,看看Link Unfurling的主题,看看如何为发布的文件提供更好的嵌入体验。