Microsoft Graph Export API for Teams supports exporting Teams messages and message hosted content for a particular user or team that is subject to compliance. Deleted messages are also accessible by the API for up to 21 days after they are deleted.
If you have enabled Microsoft Teams in your organization and want to export all the Teams messages to date of a user or a team without any filters, call the API as shown below:
GET https://graph.microsoft.com/v1.0/users/{id}/chats/getAllMessages
where, 'id' refers to 'user-id'.
GET https://graph.microsoft.com/v1.0/teams/{id}/channels/getAllMessages
where, 'id' refers to 'team-id'.
Export APIs require application permissions and consent before you can use them. The following permissions are needed:
Read.All: enables access to all 1:1, Group chat, and meeting chat messages
Read.All: enables access to all channel messages
Read.All: enables access to the list of users for a tenant
To request access to Export APIs, complete this request form. Requests made by Wednesday every week, will usually get processed in the same week.
Thanks,
Prasad Das
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.