Solved

Outlook COM Add-in: Application_NewMailEx  not getting fired

Posted on 2009-04-01
3
902 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 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
Mailbox Overload?
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…
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…

728 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