Search code examples
botframeworkmicrosoft-teams

Send pdf with smba trafficmanager or botframework


I'm trying to send pdf file as attachment proactively to teams user with https://smba.trafficmanager.net/in/v3/conversations/ and attachment format as below

"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"
            }
        }
    ]

I'm able to send txt files but not pdf, every time I'm getting

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

Is there any other contentType other than application/pdf ?


Solution

  • I agree with Hilton and Dev here. I think it's more convenient to post messages with card attachments referencing existing SharePoint files using the Microsoft Graph APIs.

    MS documents referred to 2 ways for bots send attachment. Using the Microsoft Graph APIs works for bots in all scopes in Teams while using the Teams APIs works only in the personal context.

    By the way, the document says pdf is ok to be a file type. enter image description here