How to restore deleted Microsoft Teams/OneNote items

NOTE:
The information on Teams chat messages backup and restore shared below is now outdated. Starting October 2020 the default location for archiving Teams conversations history has been changed and its backup and restore is not supported in Veeam Backup for Microsoft Office 365 v4.

Please see the “Microsoft Teams backup and recovery in NEW Veeam Backup for Microsoft Office 365 v5” article for an update on the topic.

We at Veeam Backup for Microsoft Office 365 support team receive quite a number of questions about Microsoft Teams/OneNote backup and restore on the daily basis. Since there’s no simple answer, I’ve decided to take the most frequent questions our customers have and demonstrate the details of the process.

Microsoft Teams backup and restore

The most popular question from about testing restore capabilities must be “How can you restore anything to Teams if there’s no Veeam Explorer for Microsoft Teams?”. Well, the short answer is you can only do it partially, at least for now.

If we dig deeper into Teams architecture, it turns out that messages and files you share within Teams are either stored or duplicated in other Office 365 components like SharePoint Online, OneDrive for Business and Exchange Online which we can back up and restore with help of Veeam Explorers.  

Which Microsoft Teams items can you backup

  • Chat and Team Channel messages.
    • These messages are stored under the Conversation tab in Teams and include personal messages sent 1-to-1 or to multiple recipients and messages sent to all participants of a Team.
  • SharePoint Team site and its subsites
  • Files attached to Team and Chat messages (Files tab)
  • Wiki page (Wiki tab)
  • Team OneNote Notebooks

To get an idea how this data is presented in Office 365 and in backup, let’s imagine that we have the following Teams infrastructure deployed:

1. A user Diego Siciliani who is a member of two chats.

2. He’s also a participant in a Team chat called “Backup/Restore test” which has two channels in it.

“General” channel also contains several SharePoint site pages and a message with attachment.

How to explore Microsoft Teams backup files

Now let’s find the same data inside the backup for this organization starting with Chats. We need to open the restore point created for the whole Organization in Veeam Explorer for Exchange.

In order to explore Diego’s Chat history we need to find his mailbox, navigate to “Conversation history” folder and finally a “Team Chat” subfolder inside.

Every Chat message sent or received by this user is stored here as a separate .msg file. Fields “From” and “To” allow to understand who the author is and which chat a message belongs to.

Every Team message on the other hand is stored in the same folder of another dedicated mailbox called “backuprestoretest@<orgname>.onmicrosoft.com” that has been automatically created with the Team.

It’s important to understand that if the message has any files except an image attached to it, this file won’t be stored as an attachment to a .msg file. Instead:

– For Chat message, it would be stored in OneDrive of a user who uploaded it

– For Team message, it would be stored as a part of SharePoint Online site “/sites/BackupRestoretest” that has been automatically created with the Team “Backup/Restore test”

Thus, let’s proceed to SharePoint backup. All files that were attached to messages inside Team channels are stored in a corresponding subfolder inside Documents folder.

All OneNote notes for it are stored in Site Assets folder alongside default site icon.

All site pages that belong to the main site of the Team are stored in Site Pages folder.

If a Team site has at least one subsite, it would be stored in a Subsites folder.

All Wiki pages are stored in a corresponding subfolder inside Teams Wiki Data folder.

Which items are available for Microsoft Teams restore

Direct restore to Office 365 and Teams is supported for the following items:

  • SharePoint Team sites and their subsites
  • Files attached to Team and Chat messages
  • Team OneNote Notebooks

Other types of data including messages (personal 1-to-1, to multiple recipients or to all Team Channel members) and Wiki pages can also be restored to the original location in Office 365, but Teams won’t be able to automatically recognize and import this data.

Performing partial message restore to Teams Channels

Microsoft Teams supports Webhook as a method of posting new messages to Team Channel, so it can be used to import any text including the messages that has been removed. Such messages will have current date and “Webhook” as a sender, but an original date/time and sender can be included in the text itself.

First, we need to create a webhook that would allow us to send messages to our Teams Channel from Internet using PowerShell. Let’s select the channel we want to restore to and right click on it to get to Connectors.

Add the Incoming Webhook option and click Configure.

Specify the name of your webhook (it would be shown as a Sender for all restored messages):

Optionally you can also upload an image that would be shown as an avatar for all imported messages. After that click Create and save the provided URL.

Now we need to prepare the messages for restore by converting them from *.msg to Plain Text so we can send them to our Webhook. There are many ways to achieve this and it’s up to you which one to use. In this example I exported them to *.pst.

Then we open these *.pst in Outlook and save them as *.txt.

Resulting text file looks like this:

Our messages are ready so let’s import the second one back to Teams via PowerShell.

Note: PowerShell is one of many methods to forward data to Webhook. Other methods can be used as well.

We need to specify the address of our webhook URL given at the end of webhook setup:

$uri=”https://outlook.office.com/webhook/f34cebf2-2211-4b01-b85a-440c28dd9967@66439afd-792c-4190-a0cd-e67259b69ada/IncomingWebhook/68506313d0924559b53e09ecfe37ba7c/a06f59d1-6dd9-4563-b93f-3e06be0d064b”

Then we specify the message itself:

$body = '{
 "text":"From:    Diego Siciliani \n
Sent:    Wednesday, September 25, 2019 3:08 PM \n
To:    Backup/Restore test \n
test message 2 \n
"
}'

Finally, we can send the message with the following command:

Invoke-RestMethod -uri $uri -Method Post -body $body -ContentType 'application/json'

In case of a success the PowerShell will return “1” as a result.

And you should see the message in Teams.

You may have noticed that I added “\n” symbol at the end of each line. This is to break the text in lines, otherwise it would be sent as a single line:

PS: There are more formatting options available to edit your messages. Find them in this Microsoft article.

Microsoft OneNote

Veeam Backup for Microsoft Office 365 can back up two types of Notes

Personal Notes

Such notes can be saved either on a local disk or to OneDrive for Business. In case of the latter, such files would be backed up as a part of OneDrive for Business user account and can be restored both to original and new locations. During restore process, OneNote would detect that you’ve created new file and add it to a list of user’s notes.

SharePoint Team site notes

Such notes would be created automatically upon SharePoint Team site creation.

It is stored in default library called Site Assets.

And can be restored to both new and original location.

Although currently there are no 1-click procedures in Veeam’s solution to restore Microsoft Teams and OneNote backups, a few workarounds are available. I’m looking forward to seeing the full support for these Microsoft applications in future releases of Veeam Backup for Microsoft Office 365 since the number of users is constantly growing.

Read more:

Microsoft Teams backup and recovery in NEW Veeam Backup for Microsoft Office 365 v5

Similar Blog Posts
Business | December 10, 2024
Business | December 3, 2024
Technical | November 25, 2024
Stay up to date on the latest tips and news
By subscribing, you are agreeing to have your personal information managed in accordance with the terms of Veeam’s Privacy Policy
You're all set!
Watch your inbox for our weekly blog updates.
OK