Solved

Automatically reject meeting requests by time

Posted on 2011-02-10
7
1,178 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now