How to download MS Teams Chats messages attachments using Graph API with the token created against client credentials flow on behalf of all users?
Anns
61
Reputation points
I have a script to scan MS Teams signed-in user's attachments from the user's chats. I was using authorization flow to access the files using the following URL:
"https://graph.microsoft.com/v1.0/me/drive/root:/Microsoft Teams Chat Files/{}"
Now, I have upgraded my integration method and set up the client credentials flow. For this, I am unable to fetch attachments and couldn't find any URL that will be helpful in downloading my file.
I have tried 'contentUrl' from the message response but didn't get any results.
{ 'id': 'a54b09c98-f0va-46c2-b3f7e-5daef19213f3', 'contentType': 'reference', 'contentUrl': 'https://contoso.sharepoint.com/personal/abc_xyz_onmicrosoft_com/Documents/Microsoft Teams Chat Files/file.ppt', 'content': None, 'name': 'file.ppt', 'thumbnailUrl': None, 'teamsAppId': None }