How to Export Teams Chat History

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 | 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

4 responses to “How to Export Teams Chat History

  1. Getting following error:

    Get-mailbox : The term ‘Get-mailbox’ is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + Get-mailbox -GroupMailbox | select Displayname, WindowsEmailAddress
    + ~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Get-mailbox:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Leave a Reply

Your email address will not be published. Required fields are marked *