Skip to main content

MCE Content Retention Configuration

Content Retention Overview

MCE can be configured to only retain messages for a specified period of time (specified in days), and to delete messages once they are older than that time period. This can be done via defining "Content Retention" policies. By default no policies are applied and all data is kept forever, however if your organisation has requirements related to retaining data for a set period of time then the MCE Content Retention feature can help to meet those requirements.

Once a retention period has been set, a deletion process is triggered when data meets that threshold and can no longer be retrieved, so policies should be set with care. Once set, the same command can be used to change the policy. If a change is made to reduce the retention period, data which is older than this threshold will be deleted at the next purge interval, and cannot be recovered (see purge interval). Setting a longer retention threshold will only affect new data and will not reinstate previously deleted data.

The Content Retention feature is configured via the "Global Retention Policy" related PowerShell Commands.

Warning

Setting a content retention policy can result in data being irrevocably deleted. Please ensure that any policy set is in line with your organisational data retention policies.

Enabling Content Retention

There are three steps to follow in order to enable content retention:

1. Enable the feature in the Management Tool

In the management tool, go to the Advanced Keys section and add a new key in for mce.contentretention.enabled then set the value to true.

2. One-off grain activation

This step needs to be done once, after setting the enabled content retention key to true and starting the system. It will enable content retention for all existing groups. If this is not done then content retention will not apply to groups created before version 23.1.

Run the following PowerShell command within a standard MCE PowerShell session:

Get-MceGroup | %{ Start-MceGrain -GrainType "MindLink.Core.MceAdmin.Contracts.Grains.IEffectiveGroupRetentionPolicyWriteModelGrain" -Id $_.Id }

3. Set your policy

Now that you have enabled the content retention feature, as well as making sure that existing groups are supported, you can set the current global content retention policy. Follow the instructions in the next section to set the appropriate policy.

Setting Content Retention Policies

This section assumes that you have already enabled the Content Retention feature as described above.

In version 23.1, Global Policy defines the default content retention policy for all groups and is set via PowerShell Commandlets. There are three Commandlets that are relevant:

  • Get-MceRetentionInterval - This is used to build a retention interval, which is either "Never" (meaning retain forever, never delete) or an interval in days.
  • Set-MceGlobalRetentionPolicy - This is used to set the global retention policy using a previously defined pair of intervals.
  • Get-MceGlobalRetentionPolicy - This is used to retrieve the current global retention policy.

Set-MceGlobalRetentionPolicy

Currently the Set-MceGlobalRetentionPolicy command requires a Minimum and Maximum value to be specified. This will support upcoming features, however for now just set both values to the same interval as the Minimum value is the one that is considered when deleting content. This is the interval which defines how long content should be retained.

tip

Content Retention Policies in general are designed to prefer deleting data over retaining it. What this means is that if there is ever a choice between a Minimum and Maximum value when determining the behaviour of a policy, the Minimum value will be selected.

For example, the following commands create a standard global retention policy where data is retained for 180 days before being deleted:

$interval = Get-MceRetentionInterval -Unit Days -IntervalInDays 180
Set-MceGlobalRetentionPolicy -Minimum $interval -Maximum $interval

You are also able to set "Never" as a valid interval:

$never = Get-MceRetentionInterval -Unit Never
Set-MceGlobalRetentionPolicy -Minimum $never -Maximum $never

This will result in content being retained indefinitely; so in effect it never reaches the threshold for deletion and the deletion process is never triggered.

Get-MceGlobalRetentionPolicy

You can use the Get-MceGlobalRetentionPolicy commandlet, with no parameters, to retrieve the current policy. This commandlet doesn't need parameters because there is only ever one global retention policy.

The following example output shows the result when the current global retention policy is set to a minimum and maximum of 180 days.

PS C:\mce\path> Get-MceGlobalRetentionPolicy
[17:40:03 INF] An HTTP request has returned with the following result:
HTTP Operation Parameters:
URL='https://server/mce/management/graphql',
Content-Type='application/json',
Headers='[Transfer-Encoding: chunked], [MCE-API-Version: 1.4.0], [Date: Wed, 01 Feb 2023 17:40:03 GMT], [Server: Microsoft-HTTPAPI/2.0]',
Status Code='OK',
Time-Taken='00:00:005 m:s:ms',
Data='
{
"data": {
"globalRetentionPolicy": {
"minimumDays": 180,
"maximumDays": 180
}
}
}'.

[17:40:03 INF] Completed getting MCE global retention policy.

MinimumIntervalInDays MaximumIntervalInDays
--------------------- ---------------------
180 180

The following example output shows the result when the current global retention policy is set to Never for both minimum and maximum.

PS C:\mce\path> Get-MceGlobalRetentionPolicy
[17:36:48 INF] An HTTP request has returned with the following result:
HTTP Operation Parameters:
URL='https://server/mce/management/graphql',
Content-Type='application/json',
Headers='[Transfer-Encoding: chunked], [MCE-API-Version: 1.4.0], [Date: Wed, 01 Feb 2023 17:36:48 GMT], [Server: Microsoft-HTTPAPI/2.0]',
Status Code='OK',
Time-Taken='00:00:003 m:s:ms',
Data='
{
"data": {
"globalRetentionPolicy": {
"minimumDays": null,
"maximumDays": null
}
}
}'.

[17:36:48 INF] Completed getting MCE global retention policy.

MinimumIntervalInDays MaximumIntervalInDays
--------------------- ---------------------

Configuration

The following advanced configuration keys are supported for Content Retention.

Beyond enabling or disabling the feature the only key of interest is to change the "purge interval". The purge interval defines how frequently the purge of data that violates the content retention policy occurs and is specified in hours. The default is to run every 6 hours which means that by default, every 6 hours the system will check to see if any content exists that is older than the threshold specified for the content retention policy.

KeyDefault ValueDescription
mce.contentretention.enabledfalseEnables or disables the content retention feature.
mce.contentretention.purge.interval.hours6Sets how frequently the content retention purge runs, in hours.