Office 365 Tips: Addressing Data Retention Via the RetainDeletedItemsFor Mailbox Value

Of late, it have been suggested to businesses to become more accountable for the data they create and address the retention of said data when moving to the cloud. Most clients I have interacted with have yet to implement a specific data retention policy and data deletion has become a big issue. An example of this is

“What happens when the data is deleted from your mailbox?”

Most likely the data will end up in the Recoverable Items Folder, however the need to control the data purge from this folder is of great importance. Please be careful and be knowledgeable about how and what you are modifying here. If you are unsure about the Recoverable Items Folder, the following Microsoft TechNet article will help.

The Microsoft article states:

To protect from accidental or malicious deletion and to facilitate discovery efforts commonly undertaken before or during litigation or investigations, Microsoft Exchange Server 2013 and Exchange Online use the Recoverable Items folder. The Recoverable Items folder replaces the feature that was known as the dumpster in earlier versions of Exchange. The Recoverable Items folder is used by the following Exchange features:

  • Deleted item retention
  • Single item recovery
  • In-Place Hold
  • Litigation Hold
  • Mailbox audit logging
  • Calendar logging

This post will walk through the steps of setting the RetainDeletedItemsFor value for both the Mailbox and the Mailbox Plan in Office 365 (Exchange Online). The Microsoft default value for this setting is 14 days. This means that deleted items will be retained for 14 days before they are purged from the servers. The value can be modified via a PowerShell connection to Exchange Online. One thing to note is that if you have changed the default value on premise, you will also have to set the same value in Exchange Online as the mailbox you are moving to Exchange Online will get the value from Exchange Online.

  1. View the current MailboxPlan settings in Exchange Online
    Get-MailboxPlan |ft Name,RetainDeletedItemsFor

  2. View the current setting per mailbox in Exchange Online
    Get-Mailbox -Identity User.Name | fl Identity,RetainDeletedItemsFor

  3. View the current setting all Mailboxes in Exchange Online
    Get-Mailbox | fl Identity,RetainDeletedItemsFor

Changing the Default Values

The value can be changed per mailbox or for the whole mailbox plan. Per mailbox is just as it sounds, it’s only for that one mailbox. Per mailbox plan will catch all the newly created mailboxes (including those migrated). It’s important to note that if you modify the setting after mailboxes have been created or migrated to Exchange Online, you will have to modify the value on those mailboxes as well as the mailbox plan. Basically after modifying the mailbox plan, all new mailboxes will get the new setting, while existing mailboxes will have to be updated.

The default value is set to 14 days. The max value that you can set is 30 days.

Change the current setting for the MailboxPlan in Exchange Online

Get-MailboxPlan | Set-MailboxPlan -RetainDeletedItemsFor XX

The screen shot below shows the command to change the setting, followed by the command to verify.


Change the current setting per mailbox

Set-Mailbox –Identity -RetainDeletedItemsFor XX

The screen shot below shows the command to change the setting, followed by the command to verify.