When you use the new keyword you create a new instance of your class. That's
what's required and why it works when you do use that keyword, as you
already said.
I usually handle things differently myself. I use an Inspector wrapper class
that has in it declarations for a mail item and event handlers for that mail
item and for the Inspector itself (Activate, Close, etc.). When I get
NewInspector I instantiate an instance of the wrapper class and add it to a
list to keep it alive. I set the Inspector property of the class to the new
Inspector, set the Mail property of the class to the mail item that's
Inspector.CurrentItem, and set up the event handlers including item.Open()
and so on.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Nenad Dobrilovic" wrote in
message ...
At the startup event of the add-in, it creates all mail items and keeps
them
in a dictionary, as you can see in a code example, so that it can get a
right
one when event starts.
But, even if method Get returns a mail item wrapper with the same event
ID,
it's open event never fires.
Does it mean that you can attach a event handler only on a current mail
item
of the Inspector object returned as a parameter of a NewInspector event?
--
Nenad Dobrilovic