How can I refuse to meet?

I currently have a script that I attach to the rule so that I can automatically reject meeting requests with specific topics:

Sub AutoDeclineMeetings(oRequest As MeetingItem) If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then Exit Sub End If Dim oAppt As AppointmentItem Set oAppt = oRequest.GetAssociatedAppointment(True) Dim oResponse Set oResponse = oAppt.Respond(olMeetingDeclined, True) oResponse.Send End Sub 

However, this sends a response back to the meeting organizer, who sends them out unnecessarily, because they don’t care if I attend or not.

How can I change this code so that the meeting does not appear on my calendar and that no response is sent? I tried just calling both oAppt.Delete and oRequest.Delete , but this does not remove the item from my calendar.

In fact, what I'm looking for is equivalent to manually selecting Reject β†’ Don't send a response in the meeting request.

+8
outlook-vba
source share
2 answers

Instead of oResponse.Send try oResponse.Close(olDiscard)

+1
source share
 Sub DeclineSelected() Dim Session As Outlook.NameSpace Dim currentExplorer As Explorer Dim Selection As Selection Dim currentItem As Object Dim oAppt As AppointmentItem Dim oResponse Set currentExplorer = Application.ActiveExplorer Set Selection = currentExplorer.Selection 'For all items selected... For Each currentItem In Selection 'If it is a meeting request... If currentItem.MessageClass = "IPM.Schedule.Meeting.Request" Then Set oAppt = currentItem.GetAssociatedAppointment(True) If oAppt.ResponseRequested Then Set oResponse = oAppt.Respond(olMeetingDeclined, True, False) oResponse.Delete Else Set oResponse = oAppt.Respond(olMeetingDeclined, True, False) End If currentItem.Delete 'If it is a meeting cancellation... ElseIf currentItem.MessageClass = "IPM.Schedule.Meeting.Canceled" Then Set oAppt = currentItem.GetAssociatedAppointment(True) If oAppt Is Nothing Then currentItem.Delete End If 'Delete if just an email... ElseIf currentItem.MessageClass = "IPM.Note" Then currentItem.Delete End If Next End Sub 
-one
source share

All Articles