Send Attachments to Bot in Teams

冷暖自知 提交于 2019-12-11 04:49:42

问题


I'm working with BotBuilder in .NET C#.

I can't figure out how I can send an attachment to the bot using Teams client - I've tried using the Windows desktop app and the web client but neither shows an attachment button in a chat with the bot.

I also tried with the Android client and found that I could send image attachments but not other file types, which I then went back and found that I could do the same in desktop/web clients by pasting the image into the chat box.

Using this method I do get an item in Activity.Attachments with ContentType="image/*". Any other type of file that I try to attach in the Android client is not sent to the bot (nothing in the Activity.Attachments collection) and as I said the other clients won't allow me to even attach anything in 1:1 chat.

Attaching a file in a Teams Channel adds the file to the Channel but I don't get any reference to the attachment if I @mention the bot along with the attachment.

The only mention of consuming attachments in bot sent via Teams I can find is here where it's stated that you'll need to use a JwtToken to access the file. I'm guessing this is currently a limitation in Teams as I'm able to send/receive attachments from other channels, but I'd like to confirm that there isn't some nuance that I'm missing.


回答1:


Currently, Microsoft Teams does not support the ability to send non-image files to bots.

We are currently working on delivering this feature, but we do not yet have an ETA.




回答2:


Image attachment can be send through Teams by copy pasting them in the Chat window.Teams have pushed the new Build where you can have Attachment Functionality available in Chat BOT. Now you can attach any file in the teams channel but you need to continue to send the Jwt token.

You can explore the type FileDownloadInfo which can be used to know the file type, content and other required details after you send the attachment to the BOT.



来源:https://stackoverflow.com/questions/45059877/send-attachments-to-bot-in-teams

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!