Commands › Exchange Online

New-ComplianceRetentionEvent

Exchange Online ExchangeOnlineManagement New-*

For more information, see Security & Compliance PowerShell. Use the New-ComplianceRetentionEvent cmdlet to create compliance retention events in your organization.

Quick start script

# New-ComplianceRetentionEvent — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-ComplianceRetentionEvent
$before | Format-List

# 3. Make the change (dry run first)
New-ComplianceRetentionEvent -Name <String> -WhatIf
New-ComplianceRetentionEvent -Name <String>

# 4. Verify and diff
$after = Get-ComplianceRetentionEvent
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-ComplianceRetentionEvent -Name <String>
 [-AssetId <String>]
 [-Comment <String>]
 [-Confirm]
 [-DomainController <Fqdn>]
 [-EventDateTime <DateTime>]
 [-EventTags <MultiValuedProperty>]
 [-EventType <ComplianceRuleIdParameter>]
 [-ExchangeAssetIdQuery <String>]
 [-PreviewOnly]
 [-SharePointAssetIdQuery <String>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (12)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies a unique name for the compliance retention event. The maximum length is 64 characters. If the value contains spaces, enclose the value in quotation marks (").
-AssetId String The AssetId parameter specifies the ComplianceAssetId value found in the properties of SharePoint or OneDrive documents that's used for retention. For example:
-Comment String The Comment parameter specifies an optional comment. If you specify a value that contains spaces, enclose the value in quotation marks ("), for example: "This is an admin note".
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-DomainController Fqdn This parameter is reserved for internal Microsoft use.
-EventDateTime DateTime The EventDateTime parameter specifies the date-time of the event.
-EventTags MultiValuedProperty The EventTags parameter specifies the GUID value of the labels that are associated with the compliance retention event. Run the following command to see the available GUID values: `Get-ComplianceTag | Format-Table Name,GUID`.
-EventType ComplianceRuleIdParameter The EventType parameter specifies the GUID value of the event that starts the retention period for labels that use this event type. Run the following command to see the available GUID values:...
-ExchangeAssetIdQuery String The ExchangeAssetIdQuery parameter specifies the keywords that are used to scope Exchange content for the compliance retention event. For details, see [Keyword queries and search conditions for Content...
-PreviewOnly SwitchParameter {{ Fill PreviewOnly Description }}
-SharePointAssetIdQuery String The SharePointAssetIdQuery parameter specifies one or more the Property:Value pairs that you've specified in the properties (also known as Columns) of SharePoint and OneDrive documents to scope the compliance...
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.