How to delete all calendar appointments booked by terminated users?

%3CLINGO-SUB%20id%3D%22lingo-sub-116432%22%20slang%3D%22en-US%22%3EHow%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-116432%22%20slang%3D%22en-US%22%3E%3CP%3EWe%26nbsp%3Bhave%20%26nbsp%3Ba%20Hybrid%20set%20up%20with%20o365%20and%20we%20ahve%20around%20150%2B%20Meeting%20rooms.%3C%2FP%3E%3CP%3EHow%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FP%3E%3CP%3EBefore%20deleting%2C%20we%20need%20to%20email%20out%20all%20attendees%20to%20make%20sure%20they%20know%20the%20meeting%20is%20getting%20removed.%3C%2FP%3E%3CP%3EWe%20know%20that%20we%20can%20do%20it%20by%20enabling%20mailbox%20for%20terminated%20users%20and%20then%20by%20giving%20Full%20access%20permission%20on%20their%20mailbox%20and%20then%20deleting%20the%20appointments%20using%20OWA%2FOutlook%20App.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EBut%20how%20to%20do%20this%20using%20O365%20Powershell%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3ESounder%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-116432%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-370163%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-370163%22%20slang%3D%22en-US%22%3E%3CP%3EOpen%20the%20MS%20Office%20365%20admin%20center%20-%20resources%20-%20Rooms%20%26amp%3B%20equipment%20-%20select%20the%20resource%20and%20scroll%20to%20bottom%20(look%20for%20Edit%20Exchange%20settings%20-%20go%20to%20mailbox%20delegation%20-%20Full%20Access%20-add%20yourself%20-%20log%20out%20of%20your%20outlook%20and%20back%20in%20for%20the%20change%20to%20take.%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20you%20have%20permission%20to%20delete%20the%20calendar%20entries.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-360720%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-360720%22%20slang%3D%22en-US%22%3E%3CP%3EI%20dont%20believe%20this%20does%20the%20same%20thing.%26nbsp%3B%20%26nbsp%3BYour%20script%20searches%20only%20one%20mailbox.%26nbsp%3B%20%26nbsp%3BThe%20previous%20script%20searches%20all%20mailboxes%2C%20effectively%20removing%20meetings%20form%20others'%20calendars%20as%20well.%26nbsp%3B%20%26nbsp%3BThis%20is%20useful%20when%20the%20terminated%20user%20had%20booked%20conference%20rooms%20that%20dont%20get%20freed%20up%20because%20cancellation%20notices%20are%20not%20sent%20out.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310685%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310685%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20is%20less%20complicated%20and%20worked%20perfectly%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ESearch-Mailbox%20-Identity%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSTRONG%3Esimpleuser%40abc.com%3C%2FSTRONG%3E%3CSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-SearchQuery%20'kind%3Ameetings%20AND%20From%3Auser%40abc.com'%20-DeleteContent%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-310525%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-310525%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184827%22%20target%3D%22_blank%22%3E%40Kerry%20Loftus%3C%2FA%3E%3C%2FP%3E%3CP%3ECould%20I%20ask%20for%20a%20little%20more%20information%2C%20we%20are%20experiencing%20the%20same%20issue%2C%20I%20ran%20the%20command%20in%20question%20but%20receive%20the%20following%20error%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3EThe%20target%20mailbox%20or%20.pst%20file%20path%20is%20required.%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20InvalidArgument%3A%20(%3A)%20%5B%5D%2C%20ArgumentException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20%5BServer%3DMAIL%2CRequestId%3D33b58e41-c74b-4db2-b552-c2e9ffe7489f%2CTimeStamp%3D1%2F8%2F2019%209%3A02%3A%3CBR%20%2F%3E18%20PM%5D%20%5BFailureCategory%3DCmdlet-ArgumentException%5D%208DBCE48A%3CBR%20%2F%3E%2B%20PSComputerName%20%3A%26nbsp%3BMAIL%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290078%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290078%22%20slang%3D%22en-US%22%3E%3CP%3EI%20just%20spent%20two%20days%20working%20with%20Microsoft%20on%20this%2C%20user%20has%20been%20deleted%20due%20to%20being%20disabled%20and%20placed%20in%20an%20OU%20that%20doesn't%20sync.%26nbsp%3B%20Here%20is%20the%20command%20line%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Calibri%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%3EGet-Mailbox%20-ResultSize%20Unlimited%20%7C%20Search-Mailbox%20-SearchQuery%20'Kind%3AMeetings%20AND%20Organizer%3A%3C%2FSPAN%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Calibri%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%3E%3CSTRONG%3EEmailAddressOfExEmployee%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3CFONT%20face%3D%22Calibri%2Csans-serif%22%20size%3D%222%22%3E%3CSPAN%3E'%20-DeleteContent%20%E2%80%93Force%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-287294%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-287294%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20answer%20is%20still%20the%20same.%20You%20can%20only%20Cancel%20meetings%20if%20the%20organizer's%20account%20still%20exists.%20Otherwise%2C%20best%20you%20can%20do%20is%20delete%20them.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-287143%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-287143%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20has%20been%201%20year%20since%20this%20last%20post%20and%20the%20article%20refers%20to%20exch%202010%2C%20niet%20O365.%20Any%20new%20tips%20or%20methods%20on%20how%20to%20achieve%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-117101%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-117101%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20the%20user%20doesnt%20exist%2C%20you%20will%20only%20be%20able%20to%20delete%20them%20(not%20cancel).%20There's%20an%20example%20script%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fen-US%2Fc94b2f4b-a3a0-4006-973d-b150fae078ca%2Fusing-ews-to-cancel-a-meeting-in-a-room-mailbox%3Fforum%3Dexchangesvrdevelopment%23bc8ad055-d79e-4aae-aeb2-61d835d200d6%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fen-US%2Fc94b2f4b-a3a0-4006-973d-b150fae078ca%2Fusing-ews-to-cancel-a-meeting-in-a-room-mailbox%3Fforum%3Dexchangesvrdevelopment%23bc8ad055-d79e-4aae-aeb2-61d835d200d6%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20change%20the%20method%20to%20Delete%20on%20the%20last%20line...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-116964%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-116964%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Vasil.%3C%2FP%3E%3CP%3EIf%20the%20user%20account%20DOES%20NOT%26nbsp%3B%20exists%20(%20i.e.%20If%20the%26nbsp%3B%20On%20premsise%20AD%20account%20is%20in%20disabled%20state%20and%20o365%20mailbox%20is%20in%20softdeleted%20state)%20then%20How%20to%20find%20all%20inactive%20users%26nbsp%3B%20that%20have%20booked%20meetings%20and%20how%20to%20cancel%20the%20meetings%20and%20then%20send%20email%20notifications%20to%20the%20attendees.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20scrip%20will%20be%20very%20usefull%20for%20me%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ESounder%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%3E%3CSPAN%3E%3CFONT%20face%3D%22Arial%22%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-116470%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-116470%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20the%20user%20account%20still%20exists%2C%20use%20the%20Remove-CalendarEvents%20cmdlet%3A%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fmt784593(v%3Dexchg.160).aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fmt784593(v%3Dexchg.160).aspx%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20works%20only%20for%20cloud%20mailboxes%20though.%20Otherwise%2C%20you%20will%20have%20to%20use%20some%20EWS-based%20script%20to%20find%20and%20properly%20cancel%20the%20appointments.%20Removing%20them%20via%20Search-Mailbox%20will%20not%20send%20cancelcation%20notices.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-917412%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-917412%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F162252%22%20target%3D%22_blank%22%3E%40Jeffrey%20Suarez%3C%2FA%3E%26nbsp%3Bthanks%20but%20an%20extremely%20long%20method%20for%20a%20large%20organisation.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1019895%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1019895%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F162252%22%20target%3D%22_blank%22%3E%40Jeffrey%20Suarez%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20needed%20this%20and%20worked.%20Many%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1308379%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1308379%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184827%22%20target%3D%22_blank%22%3E%40Kerry%20Loftus%3C%2FA%3E%26nbsp%3B%20HI%2C%20today%20i%20am%20using%20this%20command%20but%20its%20show%20this%20command%20is%20expire%2C%20can%20u%20please%20help%20me.%26nbsp%3B%3C%2FP%3E%3CP%3Ealso%20getting%20this%20error%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Technical_Admin_0-1586934354557.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F184443i7A977C70365DBB2A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Technical_Admin_0-1586934354557.png%22%20alt%3D%22Technical_Admin_0-1586934354557.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1308444%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1308444%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F622119%22%20target%3D%22_blank%22%3E%40Technical_Admin%3C%2FA%3E%26nbsp%3Bwhat%20is%20it%20you're%20trying%20to%20achieve%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20end%20of%20life%20warning%20shouldn't%20be%20preventing%20your%20end%20goal%2C%20as%20that's%20just%20a%20warning%20for%20Microsoft%20support%20no%20longer%20existing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYour%20SSL%20error%20is%20probably%20going%20to%20be%20down%20to%20a%20syntax%20error.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1386497%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1386497%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184827%22%20target%3D%22_blank%22%3E%40Kerry%20Loftus%3C%2FA%3E%26nbsp%3BCan%20you%20please%20explain%20what%20exactly%20this%20command%20do%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1406384%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1406384%22%20slang%3D%22en-US%22%3E%3CP%3EMight%20be%20a%20late%20answer%2C%20but%20we%20used%20the%20following%20command%20to%20clear%20out%20meetings%20booked%20by%20terminated%20users%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ERemove-CalendarEvents%20-Identity%20user%40domain.com%20-CancelOrganizedMeetings%20-QueryWindowInDays%20180%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1491060%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20delete%20all%20calendar%20appointments%20booked%20by%20terminated%20users%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1491060%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F162252%22%20target%3D%22_blank%22%3E%40Jeffrey%20Suarez%3C%2FA%3E%26nbsp%3B%20%3CSPAN%20class%3D%22tlid-translation%20translation%22%3E%3CSPAN%3ENot%20exactly%20the%20answer%2C%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22%22%3EIf%20the%20user%20account%20does%20NOT%20exist%20How%20to%20find%20all%20inactive%20users%20who%20have%20booked%20meetings%20and%20how%20to%20cancel%20them%20and%20then%20send%20email%20notifications%20to%20attendees%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Deleted
Not applicable

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

 

19 Replies

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.

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

 

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...

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?

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.

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

 

 

@Kerry Loftus

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

 

This is less complicated and worked perfectly:

 

Search-Mailbox -Identity simpleuser@abc.com -SearchQuery 'kind:meetings AND From:user@abc.com' -DeleteContent

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.  

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.

@Jeffrey Suarez thanks but an extremely long method for a large organisation. 

@Jeffrey Suarez 

 

I needed this and worked. Many Thanks.

@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

Technical_Admin_0-1586934354557.png

 

@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.

@Kerry Loftus Can you please explain what exactly this command do?

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

 

@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

@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.

@StephenHoos

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