I need to get all messages from Microsoft Team chats. Looks like Chats are stored in the Teams Storage, but their content is somehow duplicated in Exchange so you have a hidden folder called Conversation History\Team Chat where you see these conversations then. So I think that it should be something like a shared mailbox or other storage with special address to access these messages and it should be a possibility to fetch them as those from normal mailbox. But I didn't find any possibility to get them by using Exchange Web Services.
There are some basic functionality for working with Team Channels and Chats in MS Graph API but set of available endpoints is currently incomplete (e. g. We can only create chat threads but can`t fetch them. Also there is no possibility to get or create separate chat messages in API). Moreover these endpoints are under the /beta version in Microsoft Graph and are not recommended for usage:
Important: APIs under the /beta version in Microsoft Graph are in preview and are subject to change. Use of these APIs in production applications is not supported.
How can I get all Microsoft Team Chat messages using EWS API?
The Graph API for reading Teams conversations is not yet available but should be in couple of weeks.