Exchange Server and Exchange Online use retention policies to group retention tags. A retention tag defines how and when Exchange should delete a mailbox object automatically or move it to the archive mailbox. Most of the time, you think of emails when talking about Exchange mailbox objects. We stay with emails for this article.
Sometimes, retention policies show an unexpected behavior, and you want to clean up the retention information from a mailbox.
To understand how to clean up the policies, we need to know the basics.
Default tags and personal tags specify what the Managed Folder Assistant should do with the emails. You assign one or more retention tags to a retention policy. You then assign the retention policy to a mailbox.
Default tags are assigned to the whole mailbox. End users can set personal tags to folders or single elements. The third tag, the default folder tag, is primarily used in delete policies.
A retention policy can have one or more default or personal retention tags. A single mailbox can only have one policy assigned.
The following screenshot shows the default retention policies for user and arbitration mailboxes, and two additional test policies.
If you want to know more about retention tags and policies, I recommend reading the Microsoft documentation.
But what exactly would we like to remove from a mailbox?
Removing a retention policy from a mailbox is simple. You replace the assigned policy with another policy, or you set the attribute to $null to remove the policy assignment. Removing or replacing a retention policy does not remove personal tags assigned to folders by the user.
If you want to remove a personal tag from a mailbox, Microsoft has the answer for you:
But what if other users in your Exchange organization also use this personal tag? Deleting a personal retention tag from the Exchange Organization will remove this tag from all mailboxes.
Supposed you have a delete policy (default tag) set on a mailbox. Also, you allow the user to exclude folders with a personal tag. Removing this personal tag for all mailboxes will lead to significant calls for your helpdesk because the Managed Folder Assistant will delete all emails from all mailboxes. Not to say that you must restore the mails.
But help is on the way. The tool RemovePersonalRetentionTag helps you cleaning up retention tags.
With this tool, you can remove one or more personal tags from the folders in a single mailbox without deleting the tag from your Exchange Organization.
You need impersonation rights for the mailbox you want to clean up. And basic authentication needs to be enabled for Exchange Online if the mailbox is an EXO mailbox. At this time, the code uses Exchange Web Services to remove retention tags.
If you want to remove all personal tags from a mailbox, it is simple:
RemovePersonalRetentionTag.exe -mailbox "email@example.com" -impersonate
If you want to remove a specific tag, you must know the retention tag id.
First, grab a list of the retention tag ids in your environment:
Get-RetentionPolicyTag -Types Personal | Select Name,RetentionId | ft -a
RemovePersonalRetentionTag.exe -mailbox "firstname.lastname@example.org" -impersonate -retentionid "a7966968-dadf-4df7-ae87-4482686b4634"
RemovePersonalRetentionTag.exe -mailbox "email@example.com" -impersonate -retentionid "a7966968-dadf-4df7-ae87-4482686b4634, 414c6a14-3ed5-432e-9edb-c6620a8278f0"
This tool is very useful when personal MRM policies are assigned to system folders like “Yammer.”