Tagged "visual-basic"

Automatically Decline and Delete or Accept and Delete Outlook 2010 Meetings

You can follow the Microsoft TechNet guide to add VisualBasic code in Outlook rules.

You can just replace the code they give with this:

Sub AutoDeclineMeetings(oRequest As MeetingItem)

' If its not a meeting, we don't process
If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
    Exit Sub
End If

' Get the appointment in the meeting
Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)

' Send a decline response
Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingDeclined, True)
    oResponse.Send

' Lastly, delete the message
oRequest.Delete
End Sub

Sub AutoAcceptMeetings(oRequest As MeetingItem)

' If its not a meeting, we don't process
If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
    Exit Sub
End If

' Get the appointment in the meeting
Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)

' Send an accept response
Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)
    oResponse.Send

' Lastly, (optionally) delete the message
'oRequest.Delete
End Sub

For anything else you may want to do with the meeting, check the Outlook Visual Basic Developer Docs.