SOLVED

How do we send Files using Attach Icon From Teams channels using Teams bot ?

Microsoft

We have created a Teams bot and added to a channel. We were able to send and receive text messages to and from Teams bot using Teams APIs. While working with attachments, we are not able to do it...How can we send Files using Attach Icon From Teams channels using Teams bot ? In the documentation it is mentioned that we need to use Graph APIs in order to achieve this as Teams APIs supports this only in personal context.
Did anyone worked on this usecase ? If yes, pointers are highly appreciable.

Thanks,

Praveena

5 Replies
@Praveena5- We are looking into this I will get back to you soon.
best response confirmed by ChetanSharma-msft (Microsoft)
Solution

@Praveena5 -  As per document, There are two ways to send files to and from a bot:
1.Using the Microsoft Graph APIs:-
This method works for bots in all scopes in Teams: [personal , channel , groupchat]
2.Using the Teams APIs:-
These only support files in one context: [personal]

 

So, you can post messages with card attachments referencing existing SharePoint files using the Microsoft Graph APIs for OneDrive and SharePoint. Using the Graph APIs requires obtaining access to a user's OneDrive folder (for personal and groupchat files) or the files in a team's channels (for channel files) through the standard OAuth 2.0 authorization flow. This method works in all Teams scopes.

Thanks,
Sayali
--------------------------------------------------------------------------------------------
If the response is helpful, please click Mark as Best Response and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

@Praveena5 - Could you please confirm if your issue has resolved or still looking for any help?
@Praveena5 - Could you please confirm if your issue has resolved with above suggestion or still looking for any help?
Hi @ChetanSharma , Please mark this thread as resolved.!

Thanks,
Praveena