Articles in the "Meeting cancellation script" series
The default for the script is to get all appointment items for the next year. This includes all occurrences of recurring appointments. For the really busy person, or if you specify the end date beyond a year, that could mean more than the maximum of 1000 items. To accommodate more than the search result maximum, you would normally use paging. A calendar view, however, does not support paging (even though the search result has a property to indicate there are more items than what were returned). To work around this I added pseudo-paging that performs successive loops with a start date that is set to the start of the last appointment in the previous search result. This causes duplicate items in the collection of appointments, though, so I added a step to filter these. These changes are transparent, so you don’t need to do anything to accommodate mailboxes that have more than 1000 appointments.
Another change is the addition of the AttendeeMeetingsOnly parameter. This switch causes the script to only process meetings where the mailbox is an attendee. Parameter sets have been defined so you cannot use this parameter at the same time as IncludeAttendeeMeetings. This now means the options are to process meetings where the mailbox is the organizer (the default), to additionally process meetings where the mailbox is an attendee (use IncludeAttendeeMeetings), or to process only the latter (use AttendeeMeetingsOnly).
I changed the way the script identifies recurring meetings because of an issue that sometimes occurs, causing the IsRecurring property to incorrectly have a value of True on a single-instance meeting. And, lastly, already canceled meetings are now excluded. (An attendee mailbox that has received a meeting cancellation, but has not been “accepted” by the user, is already in a cancelled state in the mailbox and cannot be declined.) Thank you to Zafer for identifying bugs recently so they can be fixed.
Here is the updated script:
Cancel-MailboxMeetings.ps1 (12.7 KiB)