Autoaccept a Meeting Request using Rules

Last reviewed on June 21, 2014   —  123 comments

An interesting problem came up in the Microsoft public newsgroups this week. Richard posts:

We have a specific user requirement to auto accept meeting requests only from some selected organizers, but I don't see any choice in Rule Wizard for meeting requests. Does anyone have an idea, please?

Create a ruleOf course I have an idea. Begin with a rule using the conditions "from people or distribution list" and "uses the specified form", choosing the Meeting Request form under Application forms.

Since there is not an action to respond to meeting requests, you'll need to use a script to accept it. Outlook MVP Michal Bednarz offers this script, which you need to add to ThisOutlookSession before creating the rule.

This was tested in Outlook 2007 and should work in any version which supports the Run a Script action.

The Code

Sub AutoAcceptMeetings(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(olMeetingAccepted, True)
 oResponse.Display
End Sub

How to use

Open Outlook's VBA editor (Alt+F11), expand Microsoft Office Outlook Objects then double click on ThisOutlookSession. Type or paste the code into the module, then create the rule with the 'run script' Action and select this script

To decline a meeting, replace olMeetingAccepted with olMeetingDeclined:

Set oResponse = oAppt.Respond(olMeetingDeclined, True)

To Save with no response sent

To accept the meeting and add it to your calendar automatically, without sending a response, Christopher changed the last part of the code to:

Dim oResponse

Set oResponse = oAppt.Respond(olMeetingAccepted, True)
oResponse.Close (olSave)

End Sub

To Delete from the Inbox once processed

Add the following before End Sub:

oRequest.Delete

Apply rule to meetings scheduled for a specific day of the week

This edit uses the WeekDayName function to get the day of the week and automatically process the meeting. Use the full weekday name in the string.

dayWed = WeekdayName(Weekday(oAppt.Start))
If dayWed = "Wednesday" Then

Sub AutoAcceptMeetingsWed(oRequest As MeetingItem)

If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
  Exit Sub
End If
     
Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)

dayWed = WeekdayName(Weekday(oAppt.Start))
   
If dayWed = "Wednesday" Then

Dim oResponse
 Set oResponse = oAppt.Respond(olMeetingAccepted, True)
 oResponse.Send

End If
End Sub

Check Free/Busy before accepting

Steve wanted to know how to decline if there was a conflict. For this we need to check Free/Busy. Checking the Free/Busy is actually fairly easy and the code we need is at Recipient.FreeBusy Method.

Set yourself as a Recipient, using your email address, display name, or alias:

Set myAcct = Session.CreateRecipient("alias@slipstick.com")

Then get your Free/Busy string:

myFB = myAcct.FreeBusy(oAppt.Start, 5, False)

You need a date to check, and we'll use the appointment start date. The Free/Busy string begins at midnight on this date.

The next value is how many minutes are in each Free/Busy "period" represented by the myFB string. After much trial and error, I've decided that 5 minutes is probably the best value, since it's the smallest time period displayed on the calendar.

The final value is True or False (if you leave it blank, it's False). False tells Outlook to either return 0 for Free (and Working elsewhere in Outlook 2013) and 1 for "not free". True returns values specific to the Show time as setting.

Next, you need to know how many time periods are between midnight and the appointment time (there are 288 5 minutes periods each day):

i = (TimeValue(oAppt.Start) * 288)

Use that value to create a string of the periods the appointment covers. If you want to build in some downtime between appointments, subtract from i before calculating ( i - 2 gives 10 min between appointments) and add the same value to the duration calculation.

test = Mid(myFB, i, oAppt.Duration / 5)

test = Mid(myFB, i-2, (oAppt.Duration / 5)+2) starts 2 periods before the start time, or in my example, leaves 10 min between the last appointment and this one.

Finally, we use InStr to look for a match within the substring that covers our appointment period. If the string contains a 1, the appointment should be declined:

If InStr(1, test, "1") Then

To help you understand the code (and check my calculations), I left my Debug.Print code in. Open the Immediate windows in the VB Editor using Ctrl+G or select it from the View menu to see the results. Those 0, 1, and 2's each represent a 5 minute block of time beginning at 12:00 AM on that date.

Debug.print results in the Immediate window

Sub CheckFreeBusy(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 myAcct As Outlook.Recipient
Dim myFB As String

Set myAcct = Session.CreateRecipient("alias@slipstick.com")

Debug.Print oAppt.Duration
Debug.Print "Time: " & TimeValue(oAppt.Start)
Debug.Print "periods before appt: " & TimeValue(oAppt.Start) * 288
Debug.Print oAppt.Start

myFB = myAcct.FreeBusy(oAppt.Start, 5, False)

Debug.Print myFB

Dim oResponse
Dim i As Long
Dim test As String

i = (TimeValue(oAppt.Start) * 288)
test = Mid(myFB, i - 2, (oAppt.Duration / 5) + 2)

Debug.Print "String to check: " & test

If InStr(1, test, "1") Then
 Set oResponse = oAppt.Respond(olMeetingDeclined, True)
 oResponse.Display
 
 Else
  Set oResponse = oAppt.Respond(olMeetingAccepted, True)
 oResponse.Display
End If
End Sub

If you want to check for specific values or consider tentative appointments as Free, you can change If InStr(1, test, "1") Then to use different values. Use If InStr(1, test, "2") or InStr(1, test, "3") Then to check for Busy and Out of Office.

Free/BusyValue
Free0
Tentative1
Busy2
Out of Office3
Working Elsewhere (Outlook 2013)0

Macro Security

Macro security needs to be set on Notify for all macros. Using Enable All macros is a poor choice as it is often reset to the signed macros only option by security software or updates. If you prefer, you can sign the macro using SelfCert and set security to Signed macros only. If you choose to use SelfCert, sign the macro after you are finished editing it as it will need to be re-signed after each edit.

To access macro security dialog, go to File, Options, Trust Center in Outlook 2010. Use Tools, Macros, Security menu in Outlook 2007 and older. When security is set to Notify, you will be asked if you want to run the macro each time you start Outlook.

Complete steps for using the VBA Editor and SelfCert are at How to use the VBA Editor

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

123 responses to “Autoaccept a Meeting Request using Rules”

  1. Sadie

    Thank you so much for posting this code. I'm wondering if there is somethig similar for "not sending a response". So, when I've added the rules you have above with the code, the meeting notice accepts, but it pops open a response email where I could type a response. I have to click send on that email for it to be added to my calendar. can that step be elimanted with a rule??

    1. Sarah

      I've used this code and it does add it to my calendar but it only pulls up the email to send the response without actually sending it to the meeting requestor. Any suggestions for how to reply using the accept meeting template?

  2. LT

    This doesn't seem to work with Outlook 2010. Any suggestion?

  3. Christopher Pharo Gl

    Change the last part of the code to:

    Set oResponse = oAppt.Respond(olMeetingAccepted, True)

    oResponse.Close (olSave)

    And the appointment will be saved, no response will be sent.

    I also added

    oRequest.Delete

    at the bottom to remove it from my inbox once processed.

    This is Outlook 2010 32bit.

    1. Jamie Kitson

      oRequest.Delete didn't work for me so I just added "delete" to the rule.

    2. David

      I set this up for meetings with Subject lines that look like vacation notices (I get a lot) but discovered it has a problem when the meeting request does not require a response. In order for it to process without errors pulling up Visual Basic for debugging, I adjusted it to conditionally handling the oResponse:

      If oAppt.ResponseRequested Then
      Set oResponse = oAppt.Respond(olMeetingAccepted, True)
      oResponse.Close (olSave)
      Else 'no object to close if response was not requested
      Call oAppt.Respond(olMeetingAccepted, True) 'meeting is still accepted to calendar
      End If

  4. Ron

    Also had a problem - it worked once, then never again. Exchange 2003 with OL2010 on terminal server. I am looking for some app to do this now - hoping codetwo may do it.

  5. Ron

    I tried the setting to enable all macro, but it made no difference.

    1. Christopher Pharo Gl

      Same issue. Ended up running "selfcert.exe" which comes with the office package, create a certificate, and then choosing Tools - Digital signature in the VBA editor, choosing the newly created certificate as a signature. Upon restart, outlook asks if I want to trust it, I answer "trust all from..." and the macro has been running fine ever since.

  6. David

    I implemented the code above, along with the "Save with no response sent " and "Delete from the Inbox once processed" portions. Unfortunately, when the script runs, I get a security popup (the one where I have to wait five seconds to click yes). I have signed the script using my CAC digital certificate and also set the macro security settings to medium. Anyone have any ideas?

    I am running WINXP SP3 and Outlook 2003 SP3 in a WIN2003 domain environment with Exchange 2003 servers.

    1. David

      Forgot to add-

      I also tried signing with a regular code signing certificate and that didn't work.

      I tried the code below and it seemed to break the auto accept code above.

      --------

      OlSecurityManager.DisableOOMWarnings = True

      On Error Goto Finally

      Sub AutoAcceptMeetings(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(olMeetingAccepted, True)

      oResponse.Close (olSave)

      End Sub

      Finally:

      OlSecurityManager.DisableOOMWarnings = False

      -------

      1. David

        The CAC cert is trusted through a CA and the code signing cert is a selfcert and then I trusted myself.

  7. David Hall

    What if there is a meeting already scheduled for the same time of the new request? Is there any way of addressing a scheduling conflict?

  8. Chris

    Is there a way to Send a response without having the invitation pop up when received? I want the organizer to be able to see who has accepted without the recipient having to type in a message. In other words, the equivalent of "Send the response now." when accepting meetings... but automatic.

    Thanks! :)

  9. Chris

    I want the meeting organizer to be able to see who has accepted the invitation. Adding oResponse.Close (olSave) works perfectly but does not alow the organizer to see that it was accepted. So I do want a "response" to be sent to the meeting organizer in a sense... but I dont want the user to get a popup where they have to accept/enter a response manually.

  10. Me

    is there a way to accept canceled meetings? delete the if they were canceled?

  11. Laza_C

    This is awesome... I just had ~140 meeting requests from the same person in my inbox to set up multiple monthly meetings for the whole year and this accepted and processed them w/in 45 seconds... saved me an hr! Thanks a lot!!! Very cool stuff.

  12. Henrique

    A pop up shows up and I have to wait 5 seconds to be able to click Ok. I think David had the same issue, couldn't identify any solution in the forum. Any ideas ?

  13. Eric

    I was only able to open VB editor once (and was interrupted half way through), but now the ALT+F11 to open it no longer works. Any thoughts ?

  14. vijay

    Is there a way to extend this and decline for meetings scheduled from say 10pm to 6am?

  15. vin

    I got a problem with sending, which is the last step. Basically I get the window of the decline message but it is not being sent automatically, I need to click on the "Send" button.

    Does anybody know how to fix this ?

  16. picki

    Is there any chance to make the calender items "private" right with auto-acceptance?

  17. sharad

    it is gr8 help for me. tks.
    is there any micro which declines meeting request
    outlooke should accept 4 meeting request of starting at same time.but should decline if 5th meeting for same time. it is for shared calendar where multiple people works on same calendar.

  18. arul patrick

    excited ! gr8 wrk yar :)

    In my case i am trying to make one of my meeting room as a user .

    So when a request is sent to a user(meeting room) it should get auto accepted and a confirmation mail sould be sent depending uppon the availability . If its not available meaning the user (the meeting room) is blocked by some other user for that particular time, it should show a not available or the next available slots .

    Guys can some one of u help me ?

  19. picki

    Thanks for the quick reply. The "private setting" via

    Set oAppt.Sensitivity = olPrivate

    didn't work. Any idea on how to fix it?

  20. Christin

    Excellent! Thanks so much for this.

    However, I do have one question on a modification: I'm trying to auto-accept all-day event invitations, not meeting requests (it's how my company handles employee late/out/leaving early notifications). I'm fairly sure Outlook treats meetings and all-day events as different forms (creating a new meeting creates "Untitled - Meeting," where creating a new all-day event creates "Untitled - Event"), and the set-up you described doesn't work on these event invitations. I checked out the available forms, but couldn't find anything that sounded like the all-day event invitation form. Do you have any insight on how I can solve this problem? Thanks again!

  21. Mr Brinson

    When I use the "Save with no response sent," It automatically saves the message response to my drafts folder. What can I do to fix this?

  22. Haik

    Thanks, this was super useful

  23. Scott Redding

    Diane,
    I followed the steps above but am apparently missing something in the process. When I go set up my rule and choose 'uses the form name form' I have no forms to choose from. I am running Outlook 2007 with Exchange 2003.

  24. Scott Redding

    There are no forms to choose from on either option (Personal forms or Application forms) Is there something special I need to do when saving the script?

  25. Scott Redding

    Exchange Server.

  26. Christine Lisi

    Office 2010/32 bit

    One of the Director's here wants to Auto-Decline Meeting invitations from specific users. I know how to set up this type of rule, but need your script. I would like the meeting to be automatically declined, and then I will set the rule up to send an automatic reply to the user. Will the script you have posted (I've changed it to "DECLINE") work? I am going to test it now, but here's my code:

    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.Display
    End Sub

  27. Christine Lisi

    I would like to add a generic text response to the sender via the code. Can you help?

  28. Christine Lisi

    It's not working. Sorry for the multiple posts but it will not allow me to EDIT my original post. Thanks!

  29. Tracey Brown

    This all worked for me. Thanks so much for the notes.
    However, I want to be able to display the calendar on a wide screen for general information. Although the appointments are "accepted," placed on the calendar and no response is sent -- which is exactly what I wanted it to do -- the appointments stay in the lighter color and are hard to read. Does anyone know how to change the appearance of an appointment without having to go to each one and formally accept? I just need them to be easier to read.

    Thanks!

  30. Steve Ahlers

    I changed the following:

    oResponse.Display to oResponse.Send

    Otherwise the Accepted reply was not being sent.

  31. Amanda Marie

    This is awesome! Just one question, what do I do if I want to accept the meeting request, but want the time to appear as free on my calendar?

  32. Tim Sherburn

    I've been fighting with this for quite a while now and figured I'd just out and ask. I'm trying to configure this script to auto-decline appointments sent from a specific address. I've got the rule working and it appears to decline the appointments and delete the messages, but I keep getting my calendar filled up with they shaded versions of the appointments. I'd like the script to auto-decline and NOT send a response to the requestor.

    Here is my script:
    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.Close (olSave)
    End Sub

  33. picki

    If an auto-accepted meeting is cancelled: Is there any chance to process the cancellation in a way that the calendar entries are deleted?

  34. Jonathan

    I had an issue where 'responses' were kept in my Drafts (didn't want responses going out in this case). So I changed the code in the oResponse section as follows:

    Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)
    ' oResponse.Close (olSave)
    oResponse.Delete
    oRequest.Delete
    End Sub

  35. Christine Lisi

    This feed is very complicated, so I can't tell who is responding to what. I'm basically trying to do the same thing that Tim Sherburn is, which:

    1. Auto Decline Meeting from specific user(s)
    2. Send the Decline message back to the meeting organizer with a generic message
    3. No meeting should show on my calendar; dimmed or otherwise

    Can someone help with my script? This is what I have based on responses above but I know the oMsg section is incorrect and I'm confused as to what to put on the oResponse line. Here is what I have:

    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
    oRequest.Delete

    Dim oMsg As MailItem
    Set oMsg = Application.CreateItem(olMailItem)
    oMsg.To = oRequest.organizer ‘need the correct field name
    oMsg.Subject = “Sorry, I must decline ” & oRequest.Subject
    oMsg.Body = “reply text goes here”
    oMsg.Send

    End Sub

  36. Riaz

    This is great. I am using this script but it seems to be giving error with Outlook 2010. Is there a version for this for Outlook 64 ? Is there a way to have a rule like this on Exchange Server to say accept meeting from a particular address. Say CEO sends out an invite and it should be auto accepted by all employees.

  37. Steve Ahlers

    The original script works great. I made a slight modification to have an automatic reply sent to the user who was scheduling the meeting. I use my solution as a virtual machine running Outlook 2010 for managing a Conference Room Calendar. Here is the full script:

    Sub AutoAcceptMeetings(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(olMeetingAccepted, True)
    oResponse.Send
    oRequest.Delete

    End Sub

  38. Mark Fern

    I'm trying to set the appointment to free, but it's not working.
    Diane Poremsky May 15, 2012 at 2:14 pm | Permalink
    You need to set the busystatus and save it –

    oAppt.BusyStatus = olFree
    oAppt.Save

    This exact code did not work, so I've tried variations. Any suggestions would be helpful. Here's my code:

    Sub AutoAcceptMeetings(oRequest As MeetingItem)

    If oRequest.MessageClass "IPM.Schedule.Meeting.Request" Then
    Exit Sub
    End If

    Dim oAppt As AppointmentItem
    Set oAppt = oRequest.GetAssociatedAppointment(True)
    Set oAppt.BusyStatus = olFree
    oAppt.Save

    Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)
    oResponse.Display

    End Sub

  39. Rahul Thakur

    Hi Steve,

    Many thanks for your post, we have an issue here we use MS CRM Dynamics2011 with Outlook 2010 on our client systems.
    CRM is on premises hosted.
    Issue is that client uses a shared calender for all appoitments, and we create appoitments from CRM which goes to the person who is responsible to attend the meeting.

    But as for other it needs to appear in the shared calendar as well so that no one else book the same slot for another appoitment. For this i have created a Outlook rule for a specific subject to clone the appoitment in the shared calendar.
    Bot the only way i am able to make it work is when the person accepts the appoitment and send the reply to the generator of that appoitment.
    For this i am trying to use you script at the individual Outlook so that any appoitment with a apecific subject are auto accepted.

    you script is working fine for any appoitments created from Outlook but not for appoitments created from CRM.
    Is that a form diffrence between the both?

    It will be a great help if you have any ideas to resolve the issue.

    Regards
    Rahul

  40. Rahul Thakur

    AppointmentRequest Class

  41. Jeff B.

    I am using Outlook 2010 with MS Exchange server. I am trying to automatically accept meeting requests from a specific individual, not send a response, and have it remove the event from my inbox after accepting. I have the following script code called from a rule for all items from the specific user but nothing happens when I get events from them. Is this something to do with using exchange server or the way the meeting requests are coming from the sender?

    Sub AutoAcceptMeetings(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(olMeetingAccepted, True)
    oResponse.Close (olSave)
    oResponse.Delete
    oRequest.Delete
    End Sub

  42. Jeff B.

    When I closed Outlook it asked if I wanted to save the VBA project (even though I had been saving. After I launched Outlook again the script/rule worked. Thank you for all the great ideas and help.

  43. Sara

    This has been great as it shows me how to set up a rule to accept a meeting and send a response, but I also want to assign it to a category and show the time as free. Can I add those two things to the rule or to the macro? If the macro, what would the VBA code look like?

  44. Shelly Spradley

    I have a question. I don't want to run a script using the client but is there a way that when an appointment gets placed say on a Resource that something runs to send it out to a distribution list and automatically accepts the appointment, places it on the calendar and deletes it from the users Inbox.

  45. Pierre

    This looks very cool but I was wondering if this could also be executed via a macro toolbar button instead of a rule. I have this case where I want to look at the meeting invite before I "decline without answer". This sub does not show in the available "macros".

  46. Roland D

    I would like to have meetings accepted. However, I don't like the reminders attached to the invitation. Have you an idea how the script at the top need to be modified to have automatically accepted the meeting invitation, and at the same time removing automatically any reminder for said meeting?
    Thank you very much in advance for your comments!

  47. Roland D

    Dear Diane
    thanks for your fast reply. However, somehow it does not work....

    The code I have entered is
    --------------------------------------:

    Sub AutoAcceptMeetings(oRequest As MeetingItem)

    Dim oAppt As AppointmentItem
    Set oAppt = oRequest.GetAssociatedAppointment(True)

    Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)

    oAppt.ReminderSet = False
    oAppt.Save

    End Sub

    -------------------------------------------
    The script should in Outlook:
    -accept the meetings automatically
    -avoiding to send a feedback
    -removing any reminder to avoid being disturbed all the time by the popping-up of the reminders

    Thank you very much for your hint where the error might be....

  48. Hans

    Hi Diane,
    many thanks for this great idea!
    Unfortunatly it does not work and I have no glue why not.

    I created the rule - no Problem. But when I execute the rules the VBA code is not called. I checked it with a break point. I also checked the "first" steps of the rules. Instead calling the code I copied the meeting requests to anohter folder - works fine.
    In consequence there must be a problem with the macro call out of the rule.

    Any idea?

    My enviroment: Outlook Prof. Plus 2010/Exchange Server

    Many Greetings from Germany

  49. Varada Raghu

    Hi Daine,

    I have problem with meeting request responses. i have requested my colleague to attend a meeting through a shared calender , when he accepts it, there should be a response mail in shared mailbox, but i'm not receiving any mail from him and also i have tried with many users like this but "no" response mail after they have accepted it. please suggest me what could be the issue with this?

  50. Madison

    Hello! I have the same question as another person above. I receive automatically generated calendar requests based on my training schedule. I automatically accept them using the script above with no problem. If my class is cancelled, I get an auto-generated cancellation. I'd like to create a rule with a script that will automatically remove those cancelled items (My rules are excuted based on the subject line). Will someone share a modified script to auto remove cancelled items from my calendar? I'm assuming I would use the "MeetingCancellation" form. Thanks!

  51. Pierre

    Not possible?

  52. Brandon

    Diane, I applied the script and the rule in it's entirety works great. I have a monkey wrench to throw into this though. What if I'd like to keep this rule in effect but, I'd also like updates on meeting requests (changed times, dates, ect.) to come through the users inbox and alert them. Any ideas?
    Brandon

  53. fabian

    Hi, as part of the acceptance, I would like to add a 15 min appt 'block' of time to myself to avoid back to back meetings...I'm struggling to find the 'end time' of the meeting I am accepting and use it to set the start time of my 'block' appt. Any suggestions greatly appreciated.

  54. Larry

    Hi all I could use some help. I'm trying to auto decline and not send a response to the sender. I also don't want it to show up on my calendar, but for some reason it still shows up on my calendar and gives me a reminder. I don't know what I'm doing wrong, here is my code.

    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)
    oRequest.Display
    oRequest.Close
    oRequest.Delete
    oAppt.ReminderSet = False
    oAppt.Save

    End Sub

  55. Larry

    No it doesn't work, it still adds it to my calendar, even though it does not accept the event. I don't want it to show up on my calendar at all because it still pops up with a reminder even if I don't accept the event.

  56. Larry

    Also I'm using outlook 2013 not sure if that matters. But I have to manually click Decline with do not send a response for it to be removed from my calendar.

  57. larry

    I got it to work, looks like you have to close outlook and open it back up (if you don't close outlook it does not save the code) then accept the marco as a trusted publisher again. here is the code I used.

    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)
    oAppt.ReminderSet = False
    oAppt.Save
    Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingDeclined, True)
    oRequest.Close (olSave)
    oRequest.Delete

    End Sub

  58. Steve

    Can someone help with code that will delcine meetings if there is a conflict?

  59. Geert Roovers

    Hi! In the check for Free/Busy, you say "Next, you need to know how many time periods are between midnight and the appointment time (there are 120 5 minutes periods each day)"

    Now generally, in my 24 hour day, I have 288 5-minute periods (12 in an hour, 24 hours in a day, 24 * 12 = 288).

    Unfortunately, I cannot check if I need to change the values because of my second question:

    Set myAcct = Session.CreateRecipient("")

    Does not seem to work. At least the printout of myAcct doesn't yield anything. I'm using my e-mail address, but apparently the returned string is empty. Any ideas?

    Sorry for digging up an old thread, but people keep inviting me while I'm out of the office. Google brought me here.

  60. Geert Roovers

    Yea, I git it to work. I needed to use my user name instead of my full e-mail address in Session.CreateRecipient("").

    Also, I did need to change the 120 to 288. You just exchanged 12 5 minute periods in an hour to 5 12 minute periods :-)

    Thanks a bunch, this script is already making my out of office time easier to manage.

  61. Niveditha Pavani

    Hello,

    Without using a Rule, is there any code where Outlook picks the meeting request automatically from the Multiple mailbox for auto acceptance.

  62. Niveditha Pavani

    I want all my Meetings to be auto accepted and delcined automatically without login from my primary account.I have typed the code as below. but it shows an error.
    Public Sub GetMails()

    Dim ns As NameSpace
    Dim myRecipient As Outlook.Recipient
    Dim aFolder As Outlook.Folders

    Set ns = GetNamespace("MAPI")

    Set myRecipient = ns.CreateRecipient("XX@in.APAC.com")
    myRecipient.Resolve
    If myRecipient.Resolved Then

    Sub AutoProcessMeetingRequest(oRequest As MeetingItem)
    ' bail if this isn't a meeting request
    If oRequest.MessageClass "IPM.Schedule.Meeting.Request" Then Exit Sub
    Dim oAppt As AppointmentItem
    Set oAppt = oRequest.GetAssociatedAppointment(True)
    Dim declinedReasons As String
    declinedReasons = ""
    If (oAppt.Location = "") Then
    declinedReasons = declinedReasons & " * No location specified." & vbCrLf
    End If
    If (HasConflicts(oAppt)) Then
    declinedReasons = declinedReasons & " * It conflicts with an existing appointment." & vbCrLf
    End If
    If (DateTime.DateDiff("h", DateTime.Now, oAppt.Start) < 24) Then
    declinedReasons = declinedReasons & " * The meeting's start time is too close to the current time. " & vbCrLf
    End If
    Dim oResponse As MeetingItem
    If (declinedReasons = "") Then
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)
    oResponse.Body = _
    " Please collect the key from sekr place Near and make the entry in the meeting room register. "
    Else
    Set oResponse = oAppt.Respond(olMeetingDeclined, True)
    oResponse.Body = _
    "This meeting request has been automatically declined for the following reasons:" & vbCrLf & _
    declinedReasons
    End If
    oResponse.Send
    oRequest.Delete
    End Sub
    Function HasConflicts(oAppt As AppointmentItem) As Boolean
    Dim oCalendarFolder As Folder
    Set oCalendarFolder = ThisOutlookSession.Session.GetDefaultFolder(olFolderCalendar)
    Dim apptItem As AppointmentItem
    For Each apptItem In oCalendarFolder.Items
    If ((apptItem.BusyStatus olFree) And (oAppt apptItem)) Then
    If (apptItem.Start oAppt.Start) Then
    HasConflicts = True
    Exit Function
    End If
    End If
    End If
    Next
    HasConflicts = False
    End Function
    End If
    End Sub

    can you Help me with the code correction and also i want to do the same with Multiple Mailbox

  63. jmkelley2

    Hi Diane,

    I had a quick question. I was using the free/busy code and found that it was calculating the value of i to be 55. The time periods are in 5 minute blocks and my appointment is for 11:00 AM. The means there are 132 5 minute periods before the start time, and it kept displaying 55. I researched some more on it and found that there are actually 288 5 minute periods in a day. I change the multiplication factor on the "i =" from 120 to 288 and it now works perfectly (288 x 5)/60 = 24 hours. Did I miss something because I swear the code worked fine with 120 before?

  64. Bardhi

    Which code should I use if i want, to accept calendar but NOT TO SEND RESPONSE. ?

    Thnx a lot ;)

  65. BCPPS

    I followed your instructions for creating a Auto Decline Meetings macro, digitally signed it, and created the rule exactly as you suggested, but when I try to enable it, I get a message stating that the rule has been deactivated, that it could be because some of the parameters are not supported. Any idea? I am running MS Win-7 & MS Office Outlook Pro Plus 2010.

  66. BCPPS

    I don't see anything red, and I don't know any other way of testing it other than to put it in service on my desktop and try to use it. Here's my code:

    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.Display
    oRequest.Delete
    End Sub

  67. Philippe Baguette

    Hi, working with Outlook 2013. Using the script hereunder. Does not seem to work at all. Have neither a new accepted appointment nor a response sent to the requester.

    Any hint ?

    Public Sub AutoAcceptMeetings(oRequest As MeetingItem)

    If oRequest.MessageClass "IPM.Schedule.Meeting.Request" Then
    Exit Sub
    End If

    Dim oAppt As AppointmentItem
    Set oAppt = oRequest.GetAssociatedAppointment(True)
    oAppt.ReminderSet = True
    oAppt.Save
    Dim oResponse
    Set oResponse = oAppt.Respond(olMeetingAccepted, True)
    oRequest.Close (olSave)

    End Sub

Leave a Reply

If the Post Coment button disappears, press your Tab key.