Solved

Automatically reject meeting requests by time

Posted on 2011-02-10
7
1,165 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:pengster
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

18 Experts available now in Live!

Get 1:1 Help Now