I have the same problem with VS2003 and the Office XP PIAs. MailItem
implements _MailItem and _ItemEvents<can't remember the rest> which contains
the close event. I can access everthing in MailItem except for the Close
event. MailItemClass DOES contain a working close event BUT when I cast to
MailItemClass my addins silently fail in Outlook and I never see my buttons
or any code after I try to cast to MailItemClass. I change a couple of lines
to read MailItem and all is well except there is no Close event.
To be clear MailItemClass works on my test machines at home with the same
PIA versions and Windows, .Net and Office configurations with the exception
being that I am on Exchange at work and Internet at home. At work,
MailItemClass does nothing. I don't even get an error message. It just runs
up until I try to cast to MailItemClass.
I'm frustrated because my MailItem wrapper works fine for single items
opened in one window at a time since I can catch the Inspector close event
and do clean up. The problem is if a user navigates through several messages
in one window using the Next and Previous buttons then I don't get the
MailItem Close event and I can't do any real clean up unless my button is
pressed which then does the cleanup.