View Single Post
  #5  
Old May 3rd 07, 09:55 PM posted to microsoft.public.outlook.program_addins
PShah
external usenet poster
 
Posts: 10
Default VSTO Com-add in prevents Outlook Notes from closing first time

Ken

So here is the code in the inspectors_NewInspector method (which is
wired up in the ThisApplication_Startup)


private void inspectors_NewInspector(Outlook.Inspector inspector)
{
try
{
Object objCurrentItem = inspector.CurrentItem;
if (objCurrentItem is Outlook.MailItem)
{
// Enters this if loop if the item is Mail Item and my
complete logic is here since my plugin
// only has programming done for MailItems
}
else
{
Marshal.ReleaseComObject (objCurrentItem);
objCurrentItem = null;

GC.WaitForPendingFinalizers( );
GC.Collect( );
}
}
catch (Exception ex)
{
// Logging to local Event Logs
}
}

So Ken - as you see from above code - everything which is not an
MailItem falls into the else block (calender items, notes) etc.

I Dont do any programming for notes and totally agree with you that
they are brain-dead.

But with the above code - any item which is not MailItem falls into
the else loop (notes, calender, tasks) and even though I am cleaning
up - apparently the notes still holds a reference for inspector and so
when I click on "x" - it does close the note. When i click multiple
times on the "x" it sometimes closes the note or even crashes Outlook

What are your thoughts....

Thanks

Ads