Skip to main content

File Uploads

Upload from a file:

teams file upload --team "$TEAM_ID" --channel "$CHANNEL_ID" --file ./report.txt --output json

Upload from stdin:

printf 'smoke test\n' | teams file upload --team "$TEAM_ID" --channel "$CHANNEL_ID" --stdin --name smoke.txt --output json

Use --path for downloads unless raw stdout bytes are intentional.

Message attachments are separate

teams file works with the channel file library. Message attachments use the message command group:

teams message send --chat "$CHAT_ID" --attach ./report.pdf --output json
teams message attachments list --chat "$CHAT_ID" "$MESSAGE_ID" --output json
teams message attachments download --chat "$CHAT_ID" "$MESSAGE_ID" --dir ./assets --output json

Inline pasted images are Graph hosted contents and do not require file scopes. Attached files are SharePoint/OneDrive references and require file scopes such as Files.Read.All, Files.ReadWrite, or Files.ReadWrite.All depending on read versus send and chat versus channel.