Configuring Retention Policies in Office 365


Retention policies are used to manage email lifecycle. Retention policies are applied by creating retention tags, adding them to a retention policy, and applying the policies to mailboxes.

To Create various retention policies in Office 365 using simple PowerShell. Connect Office 365 PowerShell module and run the below cmdlets. Tweak the cmdlets as desired.

7 Years (2,556 days) Retention Policy
New-RetentionPolicyTag -Name “7 Years Retention” -Type All -AgeLimitForRetention 2556 -RetentionAction DeleteAndAllowRecovery

2 Years (730 days) Retention Policy

New-RetentionPolicyTag -Name “2 years retention” -Type All -AgeLimitForRetention 730 -RetentionAction MoveToArchive

Delete voice mail messages after 30 days.

New-RetentionPolicyTag -Name “Delete Voicemail After 30 Days” -Type All -MessageClass Voicemail -AgeLimitForRetention 30 -RetentionAction DeleteAndAllowRecovery

Permanently delete messages in the Junk EMail folder after 30 days.

New-RetentionPolicyTag -Name “Delete Junk Email After 30 Days” -Type JunkEmail -AgeLimitForRetention 30 -RetentionAction PermanentlyDelete

Apply Retention Policy to a single mailbox
Set-Mailbox “John Doe” -RetentionPolicy “RP-Finance”

Apply Retention Policy to All Mailboxes
Get-Mailbox -ResultSize unlimited | Set-Mailbox -RetentionPolicy “Delete Junk Email After 30 Days”

Placing a mailbox on retention hold suspends the processing of a retention policy or managed folder mailbox policy for that mailbox. Retention hold is designed for situations such as a user being on vacation or away temporarily.

Enable Retention Hold on a Single Mailbox
Set-Mailbox “John Doe” -RetentionHoldEnabled $true

To extract retention holds for all mailboxes, issue the following cmdlets.
Get-Mailbox -ResultSize unlimited | Where-Object {$_.RetentionHoldEnabled -eq $true} | Format-Table Name,RetentionPolicy,RetentionHoldEnabled -Auto

About Raihan Al-Beruni

My Name is Raihan Al-Beruni. I am working as an Infrastructure Architect in Data Center Technologies in Perth, Western Australia. I have been working on Microsoft technologies for more than 15 years. Other than Microsoft technologies I also work on Citrix validated solution and VMware data center virtualization technologies. I have a Masters degree in E-Commerce. I am certified in Microsoft, VMware, ITIL and EMC. My core focus is on cloud technologies. In my blog I share my knowledge and experience to enrich information technology community as a whole. I hope my contribution through this blog will help someone who wants more information on data center technologies.
Gallery | This entry was posted in Office 365 and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s