Skip to content
Advertisement

Upload files to Microsoft Teams using API

I have an access token for Microsoft Graph. I have to upload file to the channels file tab.

Can anyone help which endpoints I need to use for upload file to file tab I am calling below API:

PUT: https://graph.microsoft.com/v1.0/groups/xxxxxxxx-xxxx-xxxx-xxxx-c8550c107aad/drive/items//sites/leafletcorp.com/Shared%20Documents/Development:/abc.docx:/content?@name.conflictBehavior=rename

I am getting below response: { “error”: { “code”: “BadRequest”, “message”: “Entity only allows writes with a JSON Content-Type header.”, “innerError”: { “date”: “2021-05-05T09:12:42”, “request-id”: “a517632c-13d0-491d-8b56-8020101be95d”, “client-request-id”: “a517632c-13d0-491d-8b56-8020101be95d” } } }

Answer

The Files tab in channel is nothing it linked to SharePoint site default folder, Please take a look at Upload Files This API restricted to file size to 4MB. if you want to upload greater than 4MB please take a look at Upload larger files

Advertisement