Solved

Outlook COM Add-in: Application_NewMailEx  not getting fired

Posted on 2009-04-01
3
896 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
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 250 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

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

18 Experts available now in Live!

Get 1:1 Help Now