Retention policies govern the rules on what emails are automatically archived and deleted. They also govern what rules the users have access to for automatic archival and deletion
Prerequisites
You will need access to the company’s Office 365 Tenant with an account that has the requisite permissions to make changes in the Exchange Admin Center and the Compliance Center.
These commands require the ExchangeOnlineManagement module.
Processes
Checking a Policy’s settings
-
Get the policy name applied to a user
- Log in to the Exchange Admin Center
- On the left, go to Recipients > Mailboxes
- Search for the user you want to check the policy for
- Click on them and switch to the mailbox tab
- Go down to Mailbox policies > Retention policy
- Note the policy name
-
Check the Policy retention tags
- Log into the Compliance Center
- On the left, go to Data lifecycle management > Exchange (legacy)
- Click on the policy name that you noted previously
- Make a note of all the tags listed under the policy
-
Check the retention tags settings
-
At the top of the Exchange (legacy) page, switch to the “MRM Retention tags” page
-
For each tag noted above, check the settings
-
Type: How the rule is applied
- Personal: Applied by the user to specific folders
- Default: Applied to all folders in the mailbox, but can be overridden by a Personal or folder name policy
- “Folder name”: Applied by default to the named folder, but can be overridden by a Personal policy
-
Retention Period: How long before the Retention Action takes effect
-
Retention Action: The action to take with the email
-
Three example rules are below:
Name Type Retention Period Retention Action Explanation 1 Month Delete Personal 30 days Delete On any folder the user enables this policy on, delete any emails over 30 days Default 2 year move to archive Default 730 days Archive For any email over 2 years old, move the email into the online archive, if enabled, unless another policy is applied to that folder Junk Email Junk Email 30 days Delete Delete any email in the Junk Email folder that is over 30 days old
-
-
Creating a new policy
- Create any needed Retention tags
- Log into the Compliance Center
- On the left, go to Data lifecycle management > Exchange (legacy)
- Switch to the “MRM Retention tags” page
- Click the ”+ New tag” button
- Give the tag a good name, add a description, and click Next
- Example name: Default 1-year move to archive
- Example description: Move any emails older than a year into the online archive
- Select the option that fits your need
- Example: Automatically to entire mailbox (default)
- Set the Retention Period and Action
- Example Retention Period: When items reach the following age (in days)
365 - Example Retention Action: Move item to archive
- Example Retention Period: When items reach the following age (in days)
- Give the tag a good name, add a description, and click Next
- Repeat for any other needed retention tags
- Create a new Retention policy
- Switch to the “MRM Retention Policies” page
- Click the ”+ New policy” button
- Give the tag a good name and click Next
- Example name: Default 1-year archive
- Under Tags click Edit
- Click ”+ Add tag”
- Check off any tags that should be available or applied then click add
- Tip: Check off all the Personal tags, so the user has more options
- Click Next and Submit
- Give the tag a good name and click Next
- Apply the policy to a user
- Log in to the Exchange Admin Center
- On the left, go to Recipients > Mailboxes
- Search for the user you want to check the policy for
- Click on them and switch to the mailbox tab
- Go down to “Mailbox policies” and click on “Manage Mailbox Policies”
- Under Retention Policy, click the dropdown and switch the policy
Run the Policies
Use this command to force the applied policies to run on a mailbox
Start-ManagedFolderAssistant -Identity "[email protected]" -FullCrawl
Check the Managed Folder Assistant Progress
To check details of MFA processing for a mailbox, use the Export-MailboxDiagnosticsLogs cmdlet.
$Log = Export-MailboxDiagnosticLogs -Identity James.Ryan -ExtendedProperties
$xml = [xml]($Log.MailboxLog)
$xml.Properties.MailboxTable.Property | Where-Object {$_.Name -like "ELC*"}
Troubleshooting
Finding and resolving issues with retention policies not applying
Review Applied Personal Policies
This command will list any folder with a personal policy applied, including the path and the policy applied to the folder. This can be useful to see if a user has overridden a default policy with a personal policy
Get-MailboxFolderStatistics -Identity "[email protected]" | where {$_.ArchivePolicy -ne $null} | fl FolderPath,ArchivePolicy
Check for Holds
A retention hold can override the archiving settings, preventing them from being applied.
Get-Mailbox -Identity "[email protected]" | Select-Object *RetentionHold*