Forum Discussion
Uploading the CSV files to teams channel using python
- Jul 26, 2023
chetan_sk - yes, the second option i.e., using bot API, that limits to only personal scope. And as your intent to send files in team's channel you have to go with first approach only.
The file you intent to send must be already present in SharePoint. Once you fire the API query, it will send message with attachment directly in team's channel. (not as reference link to download the file)Thanks,
Prasad Das
------------------------------------------------------------------------------------------
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.
chetan_sk -
Using Graph API:
Post messages with file attachments that refer to existing SharePoint files, using the Graph APIs for OneDrive and SharePoint. To use the Graph APIs, obtain access to either of the following through the standard OAuth 2.0 authorization flow:
- A user's OneDrive folder for
personalandgroupchatfiles. - The files in a team's channel for
channelfiles.
Graph APIs work in all Teams scopes.
Ref: Send chatMessage in a channel or a chat - Microsoft Graph v1.0 | Microsoft Learn
Using Teams Bot API:
Teams bot APIs work only in the personal context. They don't work in the channel or groupchat context.
Using Teams APIs, the bot can directly send and receive files with users in the personal context, also known as personal chats.
Ref: Send and receive files using bot - Teams | Microsoft Learn
Sample: Microsoft-Teams-Samples/samples/bot-file-upload/python at main ยท OfficeDev/Microsoft-Teams-Samples (github.com)
Thanks,
Prasad Das
------------------------------------------------------------------------------------------
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.