Forum Discussion
Praveena5
Microsoft
Jan 06, 2022How do we send Files using Attach Icon From Teams channels using Teams bot ?
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
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.
- Sayali-MSFT
Microsoft
Praveena5 - Could you please confirm if your issue has resolved or still looking for any help?- ChetanSharma-msft
Microsoft
Praveena5 - Could you please confirm if your issue has resolved with above suggestion or still looking for any help?- Praveena5
Microsoft
- Sayali-MSFT
Microsoft
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. - Sayali-MSFT
Microsoft
Praveena5- We are looking into this I will get back to you soon.