Add-in stops getting notifications

D

David Schwartz

I wrote a C# COM add-in based on the sample from MSDN.
In OnConnection() I sign up for the
applicationObject.Inspectors.NewInspector event using the
following code:
applicationObject.Inspectors.NewInspector +=
new Outlook.InspectorsEvents_NewInspectorEventHandler
(NewInspectorMethod);

At some point I stop getting this notification.
To be more specific, when I open a new meeting request, I
add some buttons to the command bar, and when I open one
of my forms, by pressing these buttons, I stop getting
the NewInspector event.
I've checked that I don't have any unhandled exceptions
in my code, so I don't think that my code caused the add-
in to unload.

Is this a known issue? if so, is there anything I can do
to solve it?
 
D

Dmitry Streblechenko

Try to store applicationObject.Inspectors as a class variable and set up the
events as:

m_inspectors = applicationObject.Inspectors;
m_inspectors .NewInspector += new
Outlook.InspectorsEvents_NewInspectorEventHandler(NewInspectorMethod);

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top