Delete a deleted users calendar invites

Hi there,

We need to delete a calendar invite from a terminated user.
How can we do this? All i can find regard the command "Search-mailbox" which the azure shell says the following too: "search-mailbox: The term 'search-mailbox' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Also i tryed this command: Remove-CalendarEvents -Identity "user" -CancelOrganizedMeetings -QueryWindowInDays 180
But as the user is deleted, it can't be found on the database.

Hope you can help, as it seems many poeple have come accross this issue, but no fixes to be found.

We are running office365.

Regards
Alexander Parkø

Hi Alexander Parkø,

Greetings.

The method mentioned by many people is that we can do it by enabling mailbox for terminated users and then by giving Full access permission on their mailbox and then deleting the appointments using Outlook.

Besides, you may also try the worked commands mentioned in this thread: How to delete all calendar appointments booked by terminated users? - Microsoft Tech Community

Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery 'Kind:Meetings AND Organizer:EmailAddressOfExEmployee' -DeleteContent –Force

Best Regards,

Linda

-----------------------

* Beware of scammers posting fake support numbers here.

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Linda,

You just refered me to a thread which i have tried.
As i stated in my original message, then i have tried "Search-Mailbox". 
The command you refered gives this error: 
Search-Mailbox: The term 'Search-Mailbox' is not recognized as a name of a cmdlet, function, script file, or executable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Regards
Alexander Parkø

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Alexander Parkø,

May I know where are you running this PowerShell command from? 

Sorry, I found that "In cloud-based environments, the Search-Mailbox cmdlet is being deprecated in favor of New-ComplianceSearch and related eDiscovery cmdlets."

You may try creating a compliance search for any messages of kind:meetings from the terminated user and running the following command:

 

New-ComplianceSearchAction -SearchName "SEARCH TO DELETE" -Purge -PurgeType SoftDelete

Reference for you: Search for and delete email messages in your organization - Microsoft 365 Compliance | Microsoft Docs

Thanks,

Linda

-----------------------

* Beware of scammers posting fake support numbers here.

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Linda,

I try to do it from: https://portal.azure.com/#cloudshell/
After the command: Connect-EXOPSSession

I get the following:
PS /home/user> New-ComplianceSearchAction -SearchName "<*** Private Message is removed for privacy ***> " -Purge -PurgeType SoftDelete
New-ComplianceSearchAction: The term 'New-ComplianceSearchAction' is not recognized as a name of a cmdlet, function, script file, or executable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

PS /home/user>


Regards
Alexander Parkø

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Alexander Parkø,

You are running ‘New-ComplianceSearchAction’, so you should firstly connect to Security & Compliance PowerShell instead of EXO PowerShell, reference for you: Connect to Security & Compliance Center PowerShell using the EXO V2 module | Microsoft Docs

Thanks,

Linda

-----------------------

* Beware of scammers posting fake support numbers here.

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Linda,

So that got me further.

Image

Still can't seem to find the user.

Let me know how to proceed.

Regards
Alexander Parkø

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Alexander Parkø,

Did you first create a compliance search for terminated users’ messages? you should first create a compliance search for any messages of kind:meetings from the terminated user and then running the following command:

New-ComplianceSearchAction -SearchName "SEARCH TO DELETE" -Purge -PurgeType SoftDelete

 

Reference for you: https://docs.microsoft.com/en-us/microsoft-365/compliance/search-for-and-delete-messages-in-your-organization?view=o365-worldwide

Thanks,

Linda

-----------------------

* Beware of scammers posting fake support numbers here.

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

It is fine with the reference, but sadly after creating the search, then the action can't find the prior search created, eventhough i know it excists.
I simply want all deleted from the terminated user. So i have tryed the following:
Image
Regards
Alexander Parkø

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 12, 2025 Views 38,413 Applies to: