Forum Discussion

Pierre_Z92's avatar
Pierre_Z92
Copper Contributor
Nov 29, 2022

Download chatMessage attachments

Hello,

 

I am using the Graph API to fetch chatMessages of a particular user (using delegated permissions).

 

I am unable to download attachments of those chatMessages ; a GET query to the contentUrl (https://learn.microsoft.com/en-us/graph/api/resources/chatmessageattachment?view=graph-rest-1.0), returns "401 UNAUTHORIZED" error.

The contentUrl looks like : https://{devTenant}-my.sharepoint.com/personal/{userEmail}_onmicrosoft_com/Documents/Microsoft Teams Chat Files/{fileName}

The bearer token that I provide comes from this endpoint : https://login.microsoftonline.com/common/oauth2/v2.0/token (and works for any other call to the Graph API).

 

Do you have any idea of how to download attachments ?

 

Thank you in advance,

Pierre

Share

Resources