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

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.