Microsoft Teams data has many different locations. And while some locations make it easy to access and export data, others do not. Take Teams Chat History for example. This data lives in a folder of a Group mailbox. This, however, is not a typical mailbox and as such cannot be accessed in a typical way.
How to access and view contents of a GroupMailbox
First run this powershell command to get a list of all GroupMailboxes
Get-mailbox -GroupMailbox | select Displayname, WindowsEmailAddress
Using the WindowsEmailAddress run the following to view the details of the Mailbox folders for the desired Team. You will be able to view the item size of the TeamChat folder from the output.
Get-mailbox -groupmailbox Team@mycompany.com | Get-MailboxFolderStatistics | select Foldertype,ItemsInFolder
How to export TeamChat data to a .pst file
Once you have verified the GroupMailbox and the TeamChat contents with PowerShell you will then need to head over the the Security and Compliance center in your Tenancy. Here we will configure and run a Search to get the contents of the MS Team you wish to export to PST
- In the Security and Compliance Center choose Search and Content Search
- Select Guided Search
- Provide a Name, choose the Teams group as the location and add condition of Type: Equals any of E-mail messages and Instant Messages
- Save and run the query
- Select More from the menu items and choose Export Results
- Choose All items and one PST for each mailbox. You can view the Estimated export info here as well
- Once the PST has been exported you can then open it in a compatible mail client to view and save the Teams content such as Chat History