Outlook Add-In dev. problem

S

szukuro

I'm writing an Outlook Add-in using VSTO 2005. However there's a
slight problem; when I attach event handlers to the CustomAction event
of MailItems sometimes the method doesn't get called. There are cases
when attaching them more times (at run-time) overcomes this problem,
however sometimes it looks like they don't "stick", meaning I click a
custom action button once and it works, then I click it a second time
and now the handling method does not get called. I even fail to
recognize the pattern in this random behavior.
Has anyone else faced similar issues, and if so how do I overcome them?
 
A

Andrei Smolin

Hello,

You do know the answer: you should reconnect the event handlers on-the-fly.
Here, in Add-in Express, we don't know the pattern too.

Andrei Smolin
Add-in Express Team leader
www.add-in-express.com
 
K

Ken Slovak - [MVP - Outlook]

In addition to Andrei's advice also make sure all your event handlers are
declared at a class level scope so they don't go out of scope or get garbage
collected while you still need them.
 

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