Oct 13 2017 09:10 AM
Oct 13 2017 09:10 AM
We have a Hybrid set up with o365 and we ahve around 150+ Meeting rooms.
How to delete all calendar appointments booked by terminated users?
Before deleting, we need to email out all attendees to make sure they know the meeting is getting removed.
We know 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 OWA/Outlook App.
But how to do this using O365 Powershell?
Regards,
Sounder
Oct 13 2017 11:01 AM
If the user account still exists, use the Remove-CalendarEvents cmdlet: https://technet.microsoft.com/en-us/library/mt784593(v=exchg.160).aspx
That works only for cloud mailboxes though. Otherwise, you will have to use some EWS-based script to find and properly cancel the appointments. Removing them via Search-Mailbox will not send cancelcation notices.
Oct 16 2017 12:12 PM
Thanks Vasil.
If the user account DOES NOT exists ( i.e. If the On premsise AD account is in disabled state and o365 mailbox is in softdeleted state) then How to find all inactive users that have booked meetings and how to cancel the meetings and then send email notifications to the attendees.
Any scrip will be very usefull for me
Thanks
Sounder
Oct 16 2017 11:57 PM
If the user doesnt exist, you will only be able to delete them (not cancel). There's an example script here: https://social.msdn.microsoft.com/Forums/en-US/c94b2f4b-a3a0-4006-973d-b150fae078ca/using-ews-to-can...
Just change the method to Delete on the last line...
Nov 15 2018 05:23 AM
It has been 1 year since this last post and the article refers to exch 2010, niet O365. Any new tips or methods on how to achieve this?
Nov 15 2018 09:24 AM
The answer is still the same. You can only Cancel meetings if the organizer's account still exists. Otherwise, best you can do is delete them.
Nov 21 2018 11:50 AM
I just spent two days working with Microsoft on this, user has been deleted due to being disabled and placed in an OU that doesn't sync. Here is the command line:
Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery 'Kind:Meetings AND Organizer:EmailAddressOfExEmployee' -DeleteContent –Force
Jan 08 2019 01:07 PM
Could I ask for a little more information, we are experiencing the same issue, I ran the command in question but receive the following error:
The target mailbox or .pst file path is required.
+ CategoryInfo : InvalidArgument: (:) [], ArgumentException
+ FullyQualifiedErrorId : [Server=MAIL,RequestId=33b58e41-c74b-4db2-b552-c2e9ffe7489f,TimeStamp=1/8/2019 9:02:
18 PM] [FailureCategory=Cmdlet-ArgumentException] 8DBCE48A
+ PSComputerName : MAIL
Jan 08 2019 01:24 PM
This is less complicated and worked perfectly:
Search-Mailbox -Identity simpleuser@abc.com -SearchQuery 'kind:meetings AND From:user@abc.com' -DeleteContent
Mar 05 2019 12:09 PM
I dont believe this does the same thing. Your script searches only one mailbox. The previous script searches all mailboxes, effectively removing meetings form others' calendars as well. This is useful when the terminated user had booked conference rooms that dont get freed up because cancellation notices are not sent out.
Mar 15 2019 08:28 AM
Open the MS Office 365 admin center - resources - Rooms & equipment - select the resource and scroll to bottom (look for Edit Exchange settings - go to mailbox delegation - Full Access -add yourself - log out of your outlook and back in for the change to take.
Now you have permission to delete the calendar entries.
Oct 17 2019 01:03 AM
@Jeffrey Suarez thanks but an extremely long method for a large organisation.
Nov 20 2019 01:08 AM
Apr 15 2020 12:06 AM
@Kerry Loftus HI, today i am using this command but its show this command is expire, can u please help me.
also getting this error
Apr 15 2020 12:40 AM
@Technical_Admin what is it you're trying to achieve?
The end of life warning shouldn't be preventing your end goal, as that's just a warning for Microsoft support no longer existing.
Your SSL error is probably going to be down to a syntax error.
May 13 2020 06:59 AM
@Kerry Loftus Can you please explain what exactly this command do?
May 20 2020 10:31 AM
Might be a late answer, but we used the following command to clear out meetings booked by terminated users:
Remove-CalendarEvents -Identity user@domain.com -CancelOrganizedMeetings -QueryWindowInDays 180
Jun 25 2020 06:50 PM
@Jeffrey Suarez Not exactly the answer,
If the user account does NOT exist How to find all inactive users who have booked meetings and how to cancel them and then send email notifications to attendees
Jan 08 2021 07:17 AM - edited Jan 08 2021 07:18 AM
@Kerry Loftus It looks like Search-Mailbox is deprecated. What would be the new command for this?
New-ComplianceSearchAction does not seem to have a delete function.
Jan 08 2021 11:45 AM
Creating a compliance search for any messages of kind:meetings from the terminated user and running the following command worked for me:
New-ComplianceSearchAction -SearchName "SEARCH TO DELETE" -Purge -PurgeType SoftDelete
Full instructions here: Search for and delete email messages in your Office 365 organization - Admin Help | Microsoft Docs