Outlook 2003: Automatically reject meeting requests outside of mail domain

In Outlook 2003, is there a way to automatically reject meeting requests originating from outside our mail domain?  Thanks for any help!  
LVL 8
bsohn417Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, bsohn417.

Outlook does not have a built-in means of doing this.  I might be able to do it with a bit of scripting.  If successful the rejection wouldn't take place until you launched Outlook since scripting is a client-side operation.
0
bsohn417Author Commented:
Thanks BlueDevilFan.  Had a few questions:

1)  If Outlook was left open, would the meeting requests be rejected as they came in, or only at the time that Outlook was opened?

2)  This was requested by the user's personal assistant.  The mailbox is configured to "Send meeting requests and responses only to my delegates, not to me"  Would the script work OK with this setting enabled?    
0
David LeeCommented:
"If Outlook was left open, would the meeting requests be rejected as they came in, or only at the time that Outlook was opened?"
The script would work any time Outlook is running.  

"The mailbox is configured to "Send meeting requests and responses only to my delegates, not to me"  Would the script work OK with this setting enabled?"
I think so, but I'm not in a position to test with delegates so I can't say for sure.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

bsohn417Author Commented:
BlueDevilFan, thanks for all your help.  If you have something handy, I'd really appreciate it.  
0
David LeeCommented:
Here's the code for doing this.  Follow these instructions to add it to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of
5.  Outlook's VB Editor window
6.  Edit the code as needed.  I included comment lines wherever something needs to or can change
7.  Click the diskette icon on the toolbar to save the changes
8.  Close the VB Editor
9.  Click Tools > Macro > Security
10. Set the Security Level to Medium
11. Close Outlook
12. Start Outlook
13. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

Because this code has to read the email address of the sender it is going to trigger Outlook's built-in security.  That will cause a dialog-box to pop up warning the user that an application is accessing their mailbox and asking for permission to allow it to continue.  That security feature cannot be turned off, but there are ways around it.

1.  Sign the code.  Here's a link to instructions on doing that: http://msdn.microsoft.com/en-us/library/aa155754(office.10).aspx
2.  Use ClickYes (http://www.contextmagic.com/express-clickyes/), a small utility that'll click the Yes button for you.  It creates a security hole though, since a virus could start sending messages and ClickYes would click the Yes button for it too.  
3.  Use Redemption (http://www.dimastr.com), a COM library that enables code to safely bypass Outlook security.

The script is pretty simple.  It checks items as the arrive to see if they are a meeting request.  If the item is, then the script checks to see if the sending address is in SMTP format (internal senders will be in a different format).  If it is an SMTP address, then it checks to see if it's from your domain.  If it's not, then the script declines the meeting immediately.
Dim WithEvents olkInbox As Outlook.Items

Private Sub Application_Quit()
    Set olkInbox = Nothing
End Sub

Private Sub Application_Startup()
    Set olkInbox = session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub olkInbox_ItemAdd(ByVal Item As Object)
    Dim olkAppointment As Outlook.AppointmentItem
    If Item.Class = olMeetingRequest Then
        If Item.SenderEmailType = "SMTP" Then
            'Change @company.com on the next line to your domain suffix.  Be sure it begins with @.'
            If Not InStr(1, LCase(Item.SenderEmailAddress), "@company.com") Then
                Set olkAppointment = Item.GetAssociatedAppointment(False)
                olkAppointment.Respond olMeetingDeclined
            End If
        End If
    End If
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bsohn417Author Commented:
Thanks!  I'll give it a shot.  
0
David LeeCommented:
You're welcome.
0
bsohn417Author Commented:
BlueDevilFan, I tried running the script but it doesn't seem to be declining any of the relevant meeting requests.  I'm running Outlook 2003 SP3.  I followed the instructions...not sure if I'm missing something here.  Thanks for any input.  
0
David LeeCommented:
When you restarted Outlook were you prompted to enable macros?
0
bsohn417Author Commented:
Yes, I said yes to that.  
0
bsohn417Author Commented:
That is, I clicked "Enable Macros"
0
David LeeCommented:
Ok, replace the ItemAdd subroutine with the one below.  Close and restart Outlook.  The next time a meeting request arrives a dialog-box should pop up.  It will display two pieces of information: a class value and a type value.  If the dialog-box does pop up, then please let me know what those values are.
Private Sub olkInbox_ItemAdd(ByVal Item As Object)
    Dim olkAppointment As Outlook.AppointmentItem
    MsgBox "Class = " & Item.Class & vbCrLf & "Type: " & Item.SenderEmailType
    If Item.Class = olMeetingRequest Then
        If Item.SenderEmailType = "SMTP" Then
            'Change @company.com on the next line to your domain suffix.  Be sure it begins with @.'
            If Not InStr(1, LCase(Item.SenderEmailAddress), "@company.com") Then
                Set olkAppointment = Item.GetAssociatedAppointment(False)
                olkAppointment.Respond olMeetingDeclined
            End If
        End If
    End If
End Sub

Open in new window

0
bsohn417Author Commented:
Class=53
Type: EX
0
bsohn417Author Commented:
For internal calendar invites,

Class=53
Type: EX

For Internet based calendar invites,

Class=53
Type: SMTP
0
David LeeCommented:
Good.  Class 53 is a meeting request which is what the code is looking for.  The code is only going to work against Internet based calendar invites.  That's what you wanted, right?
0
bsohn417Author Commented:
Sorry for the late response.  Was out of town.  Yes, Internet based calendar invites.  I will test and let you know.  Appreciate all the help!  
0
David LeeCommented:
No problem.  Thanks for the update.
0
bsohn417Author Commented:
BlueDevilFan, I tried again using both scripts, but still no luck.  Am I doing something wrong?  I tested Internet calendar invites originating from Gmail and Exchange.  
0
David LeeCommented:
Replace the code you have now with the version below.  I added some additional popup messages to help us figure out what's going on.  Please test again and let me know which popups you see.
Private Sub olkInbox_ItemAdd(ByVal Item As Object)
    Dim olkAppointment As Outlook.AppointmentItem
    MsgBox "Class = " & Item.Class & vbCrLf & "Type: " & Item.SenderEmailType
    If Item.Class = olMeetingRequest Then
        MsgBox "The item is a meeting request."
        If Item.SenderEmailType = "SMTP" Then
            MsgBox "The request has an SMTP address"
            'Change @company.com on the next line to your domain suffix.  Be sure it begins with @.'
            If Not InStr(1, LCase(Item.SenderEmailAddress), "@company.com") Then
                MsgBox "The item is from outside of your domain"
                Set olkAppointment = Item.GetAssociatedAppointment(False)
                olkAppointment.Respond olMeetingDeclined
            End If
        End If
    End If
End Sub

Open in new window

0
bsohn417Author Commented:
Class=53
Type:SMTP

The item is a meeting request.  

The request has an SMTP address

The item is from outside of your domain
0
bsohn417Author Commented:
Not sure if it matters, but we are using Outlook 2003.  
0
David LeeCommented:
My fault.  I see my mistake now.  Replace the procedure with the version below.
Private Sub olkInbox_ItemAdd(ByVal Item As Object)
    Dim olkAppointment As Outlook.AppointmentItem, olkResponse As Object
    If Item.Class = olMeetingRequest Then
        If Item.SenderEmailType = "SMTP" Then
            'Change @company.com on the next line to your domain suffix.  Be sure it begins with @.'
            If Not InStr(1, LCase(Item.SenderEmailAddress), "@company.com") Then
                Set olkAppointment = Item.GetAssociatedAppointment(False)
                Set olkResponse = olkAppointment.Respond(olMeetingDeclined)
                olkResponse.Send
            End If
        End If
    End If
End Sub

Open in new window

0
bsohn417Author Commented:
thanks BlueDevilFan!  It now works perfectly.  If it's not too much trouble, was hoping you could help me with one more thing.  Just discovered this during the most recent testing.  

We have User A and User B.  User B is a delegate of User A.  User A's mailbox is configured to "Send meeting requests and responses only to my delegates, not to me.  So User B receives all of User A's calendar invites.  Is there a way to reject only User A's calendar invites from User B's mailbox?  Meeting requests for User B should not be rejected, only User A's.  We would run the script from User B's Outlook.  Thanks.  
0
David LeeCommented:
Would that be a separate condition (i.e. reject all external meeting requests and requests from User A, or are you saying that you want the existing condition changed to reject just those requests from User A?
0
bsohn417Author Commented:
I'd like to change the existing condition to reject external requests intended for User A (when they arrive in User B's mailbox).  
0
David LeeCommented:
Can you save such a request to .msg format and upload it here so I can have a look?  I've no means of simulating this and I'm not sure what to look for in the meeting request.
0
bsohn417Author Commented:
BlueDevilFan, sorry for the delay.  Have been swamped with other things.  Will send you the .msg when I get a sec.  Thanks again.  
0
David LeeCommented:
I understand.  Thanks for the update.  I'll be here when you're ready to proceed.
0
bsohn417Author Commented:
Thanks.  
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.