Cleaning up Microsoft 365 events from deleted users
When an employee leaves the organisation and their Microsoft 365 account is deleted, any meetings they organised, especially in room/resource calendars—do not get automatically removed. This can result in orphaned bookings that block room availability.
This article explains two methods to clean up such bookings depending on the mailbox status.
Method 1: Using Remove-CalendarEvents
(preferred for active or recently deleted mailboxes)
Remove-CalendarEvents
(preferred for active or recently deleted mailboxes)This method cancels all future meetings organised by the user and notifies attendees, including room mailboxes. It only works if:
The mailbox is still active or within the 30-day soft-delete retention period.
You have Exchange Administrator privileges.
🔧 Steps
Connect via Powershell to Exchange Online:
Preview Future Meetings:
Replace
terminated.user@company.com
with the actual user email. The-PreviewOnly
flag lets you verify what will be removed. You can increase-QueryWindowInDays
up to 1080 to cover longer ranges.Execute Cleanup (after confirming preview):
Method 2: Using compliance search (for permanently deleted mailboxes)
If the user’s mailbox is permanently deleted (past 30 days), use Microsoft Purview (Compliance Center) to search and hard-delete meetings from resource mailboxes. This method does not notify attendees.
Requirements:
Compliance Administrator or eDiscovery Manager role.
A list of resource mailbox names.
🔧 Steps
Connect to Exchange Online & Compliance Center:
Create and Start the Search:
Purge the Found Meetings:
🔍 Replace email and room addresses as needed. Use
Get-Mailbox -RecipientTypeDetails RoomMailbox
to get resource mailbox names.
It is advisable to run Remove-CalendarEvents
before deleting users.
Last updated
Was this helpful?