Forum Discussion

Praveena5's avatar
Praveena5
Copper Contributor
Jan 06, 2022
Solved

How 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...H...
  • Sayali-MSFT's avatar
    Jan 07, 2022

    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.

Resources