Forum Discussion

Praveena5's avatar
Praveena5
Icon for Microsoft rankMicrosoft
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...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.

  • 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