Hi
((Microsoft.Office.Interop.Outlook.ItemEvents_10_Event)item).Close += new
Microsoft.Office.Interop.Outlook.ItemEvents_10_CloseEventHandler(YourEventHa
ndlerHere);
I think the problem may be that ContactItem provides a method with the same
name as the Close event, which is why you don't see it in the intellisense.
I think that by casting to the ItemEvents_10_Event interface you should get
around this.
Actually, I figured out a way to do it. I used ContactItem, rather than
ContactItemClass, and the latter exposes Outlook.ItemEvents_10_Event_Close.
However, there's one thing I'm still fighting with: All my events are
properly fired when I open and close a contact. However, when I go to the
next contact, things start to go pretty much at random. If I add a delay
(MessageBox.Show telling me what just has happened), the events are fired in
the following order when I press next / previous:
1) new Inspector
2) ContactItem.Open
3) ContactItem.Close (well, actually ItemEvents_10_Event_Close)
When I try to go beyond the available items (so press next when I'm looking
at the last contact), I get a ContactItem.Close and that's it. Even though
the window is closed when I press that button, the
InspectorEvents_10_Event_Close I usually get when closing a contact, is not
fired. Only when Outlook is closed are the remaning
InspectorEvents_10_Event_Close events (belonging to the contact windows that
were closed when I tried to the contact before the first or contact beyond
the last one).
And it gets weirder. If I just add a Debug statement rather than showing a
messagebox, I no longer get the abovementioned 3 events in proper order.
Rather I get something which I can only describe as random behavior. Is
there a problem with those events or am I messing up somewhere?
Regards
Stephan