How to Auto Decline Meeting Invitations from Those Outside Your Domain in Outlook

If you never accept the meeting invitations from the senders whose email domain is not same as yours, you may hope that Outlook can auto decline the invitations from those outside your domain. This article will guide you how to achieve this via VBA.

As we all know, in most cases, the email addresses of staff in the same company are in the same domain. Under this circumstance, many users hope that Outlook can auto decline the meeting invitations from those outside their email domains. It is because such meetings generally are not organized by their companies. Now, in the followings, we’ll expose a piece of VBA code, which can realize this feature with effortless ease.

Auto Decline Meeting Invitations from Those Outside Your Domain in Outlook

Auto Decline Meeting Invitations from Those Outside Your Domain

  1. At the very beginning, start your Outlook application.
  2. Then, after accessing Outlook window, you should tap on the “Alt + F11” keys.
  3. Next, the Outlook VBA editor window will display, in which you need to open the “ThisOutlookSession” project.
  4. Subsequently, copy and paste the following VBA code into this project.
Public WithEvents objItems As Outlook.Items

Private Sub Application_Startup()
    Set objItems = Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub objItems_ItemAdd(ByVal Item As Object)
    Dim objMeetingInvitation As MeetingItem
    Dim strSenderAddress As String
    Dim strSenderDomain As String
    Dim objMeeting As AppointmentItem
    Dim objMeetingResponse As MeetingItem
 
    If TypeName(Item) = "MeetingItem" Then
       Set objMeetingInvitation = Item
 
       'Get sender's email domain
       strSenderAddress = objMeetingInvitation.SenderEmailAddress
       strSenderDomain = Right(strSenderAddress, Len(strSenderAddress) - InStr(strSenderAddress, "@"))
  
       'If not same as your mail domain
       If strSenderDomain <> "datanumen.com" Then
          Set objMeeting = objMeetingInvitation.GetAssociatedAppointment(True)
 
          'Decline it
          Set objMeetingResponse = objMeeting.Respond(olMeetingDeclined)
          objMeetingResponse.Send
          objMeetingInvitation.Delete
       End If
    End If
End Sub

VBA Code - Auto Decline Meeting Invitations from Those Outside Your Domain

  1. After that, you should sign this code. Click the “Tools” in menu bar and select “Digital Signature” from the drop down list. Then, in the newly popup dialog box, just follow onscreen instructions.
  2. Finally, you’re required to restart your Outlook program, which can activate the new VBA project.
  3. From now on, Outlook will check every incoming meeting invitation. If it is from outside your email domain, Outlook will auto decline it and remove the meeting invitation from your calendar.

Outlook Cannot Be Free from Crash

Though Outlook has many excellent abilities, it still can’t be immune from crash. It means that your Outlook data file is vulnerable and can be attacked by various dangers easily. Thus, you have to back up your Outlook file at regular interval. In addition, it is prudent and advisable to prepare an experienced and powerful PST fix tool, such as DataNumen Outlook Repair, which specializes in repairing PST.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover sql and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.