Share via


Outlook rule to auto-accept or auto-decline meeting invites

Outlook rule to auto accept / decline meetings

If you frequently get meeting invites from people that you always accept or never plan to accept, there is a way to add a macro & rule to outlook to auto-accept or auto-decline those invites.

Steps

1)     Create a digital cert to sign the macro/vba code.

2)     Create macro with vba code.

3)     Sign macro with code-signing cert

4)     Create rule to auto accept or auto decline meeting invites.

5)     Tell Outlook to trust your cert.

6)      Done!

 

Steps

1)  Create a digital cert to sign the macro/vba code.

  1. Open Open C:\Program Files (x86)\Microsoft Office\Office14\SELFCERT  (32-bit) or Open C:\Program Files (x86)\Microsoft Office\Office14\SELFCERT (64-bit)
  2. Create a digital cert named “<your name>" macro cert”
  3. This will create a digital cert on your workstation that will be used for code signing.

 

2)  Create macro with vba code.

  1. Open Outlook & hit “ALT – F11”… this will open Microsoft Visual Basic for Applications
  2. Drill down to ThisOutlookSession and paste the following code
  3. Save the code by clicking on the disk up above or clicking CTRL-S
  4. This will add 2 functions to a macro… the top is to auto-decline the meeting the bottom to auto accept.
    When you create the rule in step 4, you will get to choose the "auto-accept" or or "auto-decline" script.

 

Sub AutoDeclineMeetings(oRequest As MeetingItem)If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then    Exit SubEnd IfDim oAppt As AppointmentItemSet oAppt = oRequest.GetAssociatedAppointment(True)Dim oResponse    Set oResponse = oAppt.Respond(olMeetingDeclined, True)    oResponse.DisplayEnd Sub Sub AutoAcceptMeetings(oRequest As MeetingItem)If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then    Exit SubEnd IfDim oAppt As AppointmentItemSet oAppt = oRequest.GetAssociatedAppointment(True)Dim oResponse    Set oResponse = oAppt.Respond(olMeetingAccepted, True)    oResponse.DisplayEnd Sub

3)  Sign macro with code signing cert

  1. In Visual Basic for Applications, go to Tools > Digital Signatures
  2. Click Choose & select the cert you created in step 1 above.
  3. This step signs your code to allow Outlook to trust it to be sure to run this macro & not block it.

 

4)  Create rule to auto accept or auto decline meeting invites.

  1. Create an incoming email rule. See example below.
    You will have to create a separate rule for both auto-accept & auto-decline, but you can add endless folks to each rule.

 

5) You may have to tell Outlook to trust your cert the first time you open outlook after adding this macro.

  1. After you create the macro and restart Outlook, you may get prompted with:

 

  • Select “Trust all documents from this publisher” to allow the macro you just created in step 2 to be allowed to run in Outlook, otherwise it will be blocked and that rule will fail.
  • Under Options > Trust Center > Macros > Trust Center Settings, you can see that it is most-likely set to 'Notification for digitally signed macros, all other macros disabled. By creating a self-cert, your code is now be Digitally Signed and allowed by Outlook to execute.
  • Under Options > Trust Center > Publishers, you will see your new cert listed after you tell Outlook to “Trust all documents from this publisher”.

 

6)  Done!

  1. The rules should be set, script trusted and just waiting to auto accept or decline any incoming meeting invites from the people you have added to the rule.
  2. All meeting invites that come in under that rule should be automatically accepted or declined and moved to the deleted items folder.
  3. Bad News: This is a client side rule and will only run when Outlook is open, but will not work in OWA.
  4. More Bad News: You have to create a rule to delete regular emails from users, if you want to set that up as well.
  5. To test this, you can 'Run Rules Now' against your inbox or whatever folder you have those meeting invites coming into & it should clean it up and also remove them from your calendar, currently appearing as "This meeting has not been accepted".