When someone cancels a meeting, the cancellation notice removes the meeting from the attendees calendar automatically but does not remove it from the resource calendar. This is to preserve a historical list of use for resource planning purposes and shows users possible conflicts.
Microsoft recommends using a custom view to hide cancelled meetings from users.
Note the Free/Busy should update (on the next scheduled Free/Busy publish) to reflect the cancelled meeting (the time will be shown as Free), so leaving the cancelled meetings in place should not affect scheduling.
Administrators can set the RemoveOldMeetingMessages parameter to remove cancelled meetings from resource calendars as the meetings are canceled.
Please note that this applies to meetings cancelled after setting RemoveOldMeetingMessages to true. It will not remove items cancelled previously; these will need to be removed manually, either using the macro or a filtered view that displays only canceled meetings. It also will not remove meetings created by Direct Booking (where the user opens the room calendar), the resource needs to be invited.
In Exchange 2010 and newer, including Office 365 Exchange online, use the Set-CalendarProcessing cmdlet:
Set-CalendarProcessing -Identity "room1" -RemoveOldMeetingMessages $true
In Exchange 2007, use the Set-MailboxCalendarSettings cmdlet:
Set-MailboxCalendarSettings -Identity "room1" -RemoveOldMeetingMessages $true
Macro to remove cancelled meetings
This macro will search through a resource calendar and delete items with "Canceled:" in the subject. You also must have proper permissions on the resource mailbox for this to work.
This macro will remove cancelled meetings will remove both direct booking and autoaccepted meetings.
Don't forget to change this line to the correct mailbox name:
Set olResCalendar = OpenMAPIFolder("\MailboxName\Calendar")
Sub RemoveCanceledAppointments() Dim olResCalendar As Outlook.MAPIFolder, olApptItem As Outlook.AppointmentItem, intCounter As Integer 'Change the path to the resource calendar on the next line Set olResCalendar = OpenMAPIFolder("\MailboxName\Calendar") For intCounter = olResCalendar.Items.Count To 1 Step -1 Set olApptItem = olResCalendar.Items(intCounter) If Left(olApptItem.Subject, 9) = "Canceled:" Then olApptItem.Delete End If Next Set olApptItem = Nothing Set olResCalendar = Nothing End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath <> "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(Obj) If TypeName(Obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function
How to use the RemoveCanceledAppointments macro
The RemoveCanceledAppointments macro will search through a resource calendar and delete all canceled appointment items. It searches the resource calendar, looking for appointments with a subject beginning with "Canceled:". It works in all versions of Outlook and can be used on Exchange 2007 and Exchange 2010 resource mailboxes, if the RemoveOldMeetingMessages parameter is not set to true.
If a cancellation notice wasn't sent, then there is no way to know if a meeting was canceled.
Before beginning, if your macro security settings are not configured to allow macros to run, you'll need to take care of this:
- Go to Tools, Macro, Security
- Set the Security Level to Medium
- Close Outlook
- Restart Outlook
Depending on your version of Outlook, you may need to restart it in order to use the macro.
Next you'll need to
- Add the resource mailbox to your profile. You must have permissions on the resource mailbox for this to work.
- Press Alt+F11 to open the VB editor
- If not already expanded, expand ThisOutlookSession
- Copy the macro and paste it into the right-hand pane of the VB Editor
- Edit the macro as needed (Remember to change the mailbox name!)
- Save the changes
- Run the macro (press F5 to run it in the VB Editor)
Hallo,
I am wondering if that is possible to delete a canceled meeting in series aswell
Delete a single occurrence in a series using a macro? Yes, but it would be a complicated macro as you need to get all of the events in the series and delete one.
I am thinking if it is possible to use this macro with several mailboxes at once.
Yes. You need to loop the mailboxes - using select case to set the mailbox might work best.
for i = 1 to [total mailboxes]
select case i
case 1
Set olResCalendar = OpenMAPIFolder("\MailboxName\Calendar")
case 2
Set olResCalendar = OpenMAPIFolder("\Mailbox2Name\Calendar")
'case for each mailbox
end select
' do the removals
next i
Thank you! However I have encountered an other problem. I try to explain it clear. When a single occurence is canceled within a series, then this script can not delete that single item. If I cancel the entire series, then it works well (removes all meetings).
In the calendar it looks the same - as if the single meetings subject has changed to "Canceled:.." while the others have not, but still script can't find it.
(It should be something with the recurring meetings subject. I expect it is stored for the entire series and somehow differently for the occurences within.)
Is it possible to delete them?
My organization would like to remove room reservations for an employee who leaves the organization- to free the room reservations and show the rooms as free. can this be done?
An employee booked a recurring meeting in a conference room, then departed the organization. How can that meeting be removed?
If someone with owner permissions to the conference room can't delete it from the calendar, you'll need to use MFCMAPI to delete it. Note that attendees will need to delete it from their own calendar.
If the person's mailbox is still available, the admin can log into it and cancel any meeting on the calendar.
Hello i am getting a compile error when i try to run the script.
On this line it says that the sub or function is not defined and the script does'nt run.
Set olResCalendar = OpenMAPIFolder("\MailboxName\Calendar")
You should definitely have the openmapifolder function - it's in the code - Function OpenMAPIFolder(szPath).
That is the name of the calendar as it is listed in your folder list?
I tried to get this setting changed with IT but they said they cannot change it to automatically remove from the resource as not all users have "accepted" the meeting cancellation email, of which it then removes once all accepted.
Are they telling me lies in that you can clear cancelled meetings even if people don't accept the cancellation email? if so does that mean users will get a cancellation email and just not see it anymore in their own calandars?
You can delete it - users don't "accept" cancellation. When you cancel a meeting, invitees are notified and the appointment is removed from their calendar. The only reason to leave it on the resource is for history - many sites find it useful when they review resource usage.