?
Solved

Outlook COM Add-in: Application_NewMailEx  not getting fired

Posted on 2009-04-01
3
Medium Priority
?
905 Views
Last Modified: 2012-05-06
I noticed that Application_NewMailEx is not getting called on new mail arrieved. Do I need to set any object for this event as well as we did it in objMailItem_Send in http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_24253844.html?

Thanks.
0
Comment
Question by:deshaw
[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
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 1000 total points
ID: 24037871
Hi, deshaw.

Yes, objects ALWAYS have to be initialized before they can process events.  Application_NewMailEx will work fine in Outlook without you doing anything because Application refers to an intrinsic object in Outlook.  But, add-ins don't have the application object by default.  Your add-in code has to create an instance and initialize it.  Since you are using that add-in template, I believe it has done the work for you.  Does it contain a line something like

    Dim WithEvents objApp As Outlook.Application

If so, then to trap the NewMailEx event you simply need to modify your code to read

    Sub objApp_NewMailEx

instead of
    Sub Application_NewMailEx

In this case objApp is your add-in's instance of the application object.  Does that make sense?
0
 
LVL 1

Author Closing Comment

by:deshaw
ID: 31565249
thanks. that works perfectly.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24038110
You're welcome.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

762 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