Commands › Exchange Online

Remove-CalendarEvents

Exchange Online ExchangeOnlineManagement Remove-*

Cancel future meetings in user or resource mailboxes. Cancelling future meetings removes them from attendee and resource calendars (for example, you're going to remove the mailbox, or the user is going on a leave of absence).

Quick start script

# Remove-CalendarEvents — 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-CalendarEvents
$before | Format-List

# 3. Make the change (dry run first)
Remove-CalendarEvents -Identity <MailboxIdParameter> -QueryWindowInDays <Int32> -WhatIf
Remove-CalendarEvents -Identity <MailboxIdParameter> -QueryWindowInDays <Int32>

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

Syntax

Remove-CalendarEvents [-Identity] <MailboxIdParameter> -QueryWindowInDays <Int32>
 [-CancelOrganizedMeetings]
 [-Confirm]
 [-PreviewOnly]
 [-QueryStartDate <ExDateTime>]
 [-UseCustomRouting]
 [-WhatIf]
 [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-Identity MailboxIdParameter yes The Identity parameter specifies the mailbox that you want to modify. You can use any value that uniquely identifies the mailbox. For example:
-QueryWindowInDays Int32 yes The QueryWindowInDays parameter specifies the number of days after the QueryStartDate parameter value to look for meetings that you want to cancel.
-CancelOrganizedMeetings SwitchParameter The CancelOrganizedMeetings switch specifies whether to cancel meetings in the mailbox. You don't need to specify a value with this switch.
-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.
-PreviewOnly SwitchParameter The PreviewOnly switch specifies whether to preview the results of the command without actually cancelling any meetings. You don't need to specify a value with this switch.
-QueryStartDate ExDateTime The QueryStartDate parameter specifies the start date to look for meetings that you want to cancel.
-UseCustomRouting SwitchParameter This parameter is available only in the cloud-based service.
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

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