Solved

Automatically reject meeting requests by time

Posted on 2011-02-10
7
1,458 Views
Last Modified: 2012-06-22
How can I make outlook 2007 automatically reject meeting/invites requests by time.

There are folks in my company that tries to slip in a meeting into my calendar after my work hours.
People in different depts tend to have varying official working hours. But my calendar is normally so booked up during the day that some people try to book me for meetings as late as midnite.

It would be a bonus if I can reject meeting requests at specific times - like my lunch time.

The Resource Scheduling under Calendar options doesn't help because it forces me to also automatically accept meetings. which I don't ever want to do. I realize outlook does not readily provide such a feature.
but in  this related question, BlueDevilFan had a solution to reject meeting from outside a domain. Can a similar solution be found for my question?

thanks in advance
0
Comment
Question by:pengster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 34867625
Hi, pengster.

Yes, that's possible.  The code below should do what you've described.  Yo can change the times as needed.
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
    Dim rrEID As Variant, varEID As Variant, olkItm As Object, olkAppointment As Outlook.AppointmentItem
    arrEID = Split(EntryIDCollection, ",")
    arrWords = Split(KILL_WORDS, ",")
    For Each varEID In arrEID
        Set olkItm = Session.GetItemFromID(varEID)
        If olkItm.Class = olMeetingRequest Then
            Set olkAppointment = olkItm.GetAssociatedAppointment(False)
            If DatePortion(olkAppointment.Start) = DatePortion(olkAppointment.End) Then
                If TimePortion(olkAppointment.Start) <= #1:00:00 PM# And TimePortion(olkAppointment.End) >= #12:00:00 PM# Then
                    olkAppointment.Respond olMeetingDeclined
                End If
            End If
        End If
    Next
End Sub

unction DatePortion(datValue As Date) As Date
    DatePortion = Format(datValue, "dd/mm/yyyy")
End Function

Function TimePortion(datValue As Date) As Date
    TimePortion = Format(datValue, "hh:mm:ss")
End Function

Open in new window

0
 

Author Comment

by:pengster
ID: 34890344
Hi BlueDevilFan,

Thanks very much for the VB script.
Silly me. i spent the last few days trying to figure out how to get this script into my outlook only to find out you had given a step-by-step howto in the other related question. lol.

Needless to say I'm a noob at VB scripts and it's probably because of that I couldn't get your script to work. I know enough programming to correct the "unction" to "Function" in the script. But beyond that I'm lost.

I tried replacing the #12:00:00 PM# with "12:00:01" and #12:00:01PM#. Neither worked.
I tried a few other combinations with quotes, 12hr vs 24hr formats, etc. None seems to work.
I'm probably too noobie to figure out the correct way to specify the time.

Each time a meeting is send to me at 12:00:01 pm. I get the meeting request with the accept/decline buttons. But the Sender does not get a "Declined" reply. I have to physically decline it before the Sender gets the decline.

what could I be doing wrong?
Thanks
pengster


0
 
LVL 76

Expert Comment

by:David Lee
ID: 34891511
You're welcome, pengster.

Sorry about the "unction" typo.  

The way it's set up now it will decline any appointment that starts and ends on the same day where any portion of the appointment is between 12:00 PM and 1:00 PM.  I tested it before posting, so I know it works.  Are you sure that macros are enabled and working?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pengster
ID: 34900619
How can I verify the macro is enabled/running?
I can see the script inside the Macro Editor after I restart outlook 2007.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34901243
Add a command like

    Msgbox "Script fired"

immediately after line #2 of Application_NewMailEx.  When new messages arrive a dialog-box should popup saying "Script fired".
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 37373012
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question