Forum Discussion
Pierre_Z92
Nov 29, 2022Copper Contributor
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
- Meghana-MSFT
Microsoft
we are looking into this, we will get back to you.- Meghana-MSFT
Microsoft
we are also seeing the same behavior. We will check internally and get back to you.- Meghana-MSFT
Microsoft
Pierre_Z92 - Engineering team has said that -
You can use this API - https://learn.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=http Plug in the sharepoint link from chatMessage attachment and it will get you the download links you need. Additional reference https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http