/MSTeamsChatExporter

Code that helps an end-user export their Microsoft Teams Chat History to HTML

Primary LanguagePowerShellMIT LicenseMIT

Microsoft Teams Chat Exporter

The repository contains a PowerShell script that allows you to export your Microsoft Teams chat conversations, in HTML format, to your local disk.

Example of Export HTML file

Example of Exports in directory

Getting Started

Prerequisites

Steps

  1. Download this repository

  2. Create a blank folder where you'll have your chat history exported to

  3. Run the Powershell script

    PS> Get-Help ./Get-MicrosoftTeamsChat.ps1
    ...
    PS> ./Get-MicrosoftTeamsChat.ps1 -ExportFolder C:\Users\<you>\OneDrive\ExportChat\ -clientId "0728c136-cc8c-4b29-bbb7-e20c5c35f53a" -tenantId "b2541388-a22b-4b8d-b027-883ad6b445a7" -domain "contoso.com"
  4. Watch the slow crawl magic happen, exporting your chat history.

Contribute

Feel free to contribute and make this script better! License is MIT

Ideas

Here are some suggested improvements ideas:

  • Script support for PowerShell 5.1 so it can be run by anyone with a Windows 10 machine (without needing to install PSCore)

  • The script could be refined to be a bit (a lot) quicker. Lots of foreach loops and not a lot of time spent on possibly making it asynchronous which help it be speedier.

  • HTTP 429 retries to manage throttling. See Microsoft Docs.

  • The script makes all the images base64 encoded in the HTML files. This is okay for 95% of the time but there are potentially some threads out there with big images in them. Might make the HTML files quite large!

  • Scripts need better commenting for documentation purposes.