howto://automatically delete conversation history in Office 365


One of the most useful parts of Lync is that it automatically saves conversations in a mailbox folder called “Conversation History.” I probably refer to content in there three or four times a day-what did my boss ask for? What what that URL Tim sent me? Who did I promise to send something to? Which customer wanted to do X? When you’re a hardcore multitasker and don’t have an eidetic memory, Conversation History can be a lifesaver. But if it is in your mailbox, then it becomes discoverable, and there are some companies (or rather, some legal departments in some companies) that think users will spill the beans in an IM, so they want to make conversation history go away. IF you don’t want to save Conversation History at all, for any user, with any client, then you can use Lync Online remote PowerShell to do that. This is not that blog post.

This blog post is for when you are willing to save Conversation History for a period of time, but not for as long as other content. You’re willing to let users keep, for example, the past 30 days worth of history, but no more than that. To do that, you can use an MRM policy.


If you are not familiar with Message Retention Management policies in Office 365, see for all the juicy bits. The most important thing you want to know is how they go together…you create tags that are added to a policy, and you apply that policy to a mailbox, like so. d289533e-c1e6-4fea-8a44-90b699fac47d

There is a lot more you can do with MRM than just wack stuff, but this post is on Lync Conversation History and not MRM, so let’s get back to Lync.

Our hypothetical situation

Suppose your legal team decides to let users keep Conversation History for 30 days, but then wants it gone for good. You can come close to that with an MRM policy, but you need to understand how things work.

How things work

To automate deletion of items, you use MRM policies. MRM policies are processed by the Managed Folder Assistant (MFA,) which runs every 7 days (see KB2627729.) To account for the age of an item, and variance between local time zone of user and the local time zone of server hosting the mailbox, an item can age to desired interval + 0~7 days. Since 1 day is the minimum age you can set, 8 days is the minimum timeframe that can be reliably and consistently met. Message content that is already 30 days old when our example policy runs will be deleted. But if there is an item in Conversation History that was 29 days old when the MFA runs, it will stick around for another week. Let’s see, 29, add 7, carry the one…means you will have some content that makes it over a month, but not much more than that.


At a high level, we are going to create a retention policy tag that will delete items in the “ConversationHistory” folder that are older than 30 days. Then, we will add this tag to the default MRM policy. The example below uses the default policy. You could always create other policies and use the same tag with them. This tag is going to take advantage of the fact that the “Conversation History” Folder is considered a default/system folder, and is called ConversationHistory internally.

1) Open a remote PowerShell session and connect to your tenant using a Global Admin account.

2) Enter this command, to ensure no data in responses are truncated.


3) Get the list of existing MRM policies using this command. Save this data in case you need to “reset” a policy to where it was before you make any changes.

get-retentionpolicy | fl

get-retentionpolicytag | fl

4) Create a new retention policy tag. In the following example, the following values are set:

Name: LyncConversationHistoryPolicy
Folder impacted: ConversationHistory, the internal name for the “Conversation History” folder in a Lync user’s mailbox.
Comment: freeform text for your reference
Minimum age for items: 30 days
Action to take: Permanently delete

New-RetentionPolicyTag "LyncConversationHistoryPolicy" -Type ConversationHistory -Comment "Permanently deletes conversation history items" -RetentionEnabled $true -AgeLimitForRetention 30 -RetentionAction PermanentlyDelete

5) To add this new tag to your default MRM policy, you can either use the EAC, or run this set of PowerShell commands.
$TagList = (Get-RetentionPolicy "Default MRM Policy").RetentionPolicyTagLinks

$TagList.Add((Get-RetentionPolicyTag 'LyncConversationHistory').DistinguishedName)

Set-RetentionPolicy "Default MRM Policy" -RetentionPolicyTagLinks $TagList

Workaround for that whole seven day thing

You could run the Start-ManagedFolderAssistant -Identity cmdlet for a specific user, or perhaps play with something like get-mailbox -resultsize unlimited | start-managedfolderassistant on a scheduled basis, but this will not scale, and will likely invoke PS throttling. The seven day interval is by design and I don’t suggest you mess with trying to get around that.

A note on small mailboxes

Mailboxes less than 10 MB in total size are not processed by the MFA. Your only choice for these is to manually run the MFA using the remote PowerShell cmdlet.

Start-ManagedFolderAssistant -Identity

Hopefully you will never need to use this. Conversation History is just too darn valuable in my opinion to take away, but if the legal eagles upstairs just don’t care, or if Der Kommissar is in town, then what I have above should fix you right up. But tell me, are they really concerned that you might put something in an IM that you wouldn’t in an email? That sounds like an end-user issue to me, best addressed by HR.

Leave a Reply

Your email address will not be published. Required fields are marked *