I want to backup my Teams teams!

1200px-Microsoft_Office_Teams_(2018–present).svg

A thought came to mind that what should you do if you want to have a backup of your Teams team? There might be several scenarios you would want to do this for. It could be everything from archiving historical data, send channel chat conversation logs to a 3rd party instead of giving them access to the team or recreating them in a new tenant. Maybe you only want to send them a log of parts of the conversations?

I wrote for a long time ago a script that archives Teams channel conversations to an HTML file. This was a pretty simple script, with no fancy formatting on the output. A lot has changed since that time, also regarding permissions for extracting chat. Now you need to fill out a form and send it to Microsoft to be able to use application permissions to do this, so it would be easier to add an admin user to the team while extracting the chat in user context. Lee Ford have written a fantastic tool/script to create backups of Teams teams including chatlogs exported as an HTML file with CSS formating so it looks a lot more interesting than a TXT file. You can even backup all files from each channel with this script. You can find the script over here.

This has been made possible through the awesome Microsoft Graph API. The only thing stopping this from being a complete Teams migration tool is that the impersonation of users is not possible, so you cant repost the messages in a new tenant as the user. You can post it as the admin, but then I think its a lot better to have it in an HTML file you can make searchable in SharePoint.

Leave a comment