Problem with NewInspector event when opening attachments

Joined
Feb 26, 2006
Messages
2
Reaction score
0
Hi all,

I've programmed an outlook add-in that creates a wrapper for mail items and creates in the inspector a custom menuBar. The add-in functions well, but in one scenario problems occur. When I do the following steps the error "The operation failed" occurs:

1. I open a Mail Item -> The menuBar appears
2. I open an attached mail item -> The menuBar appears
3. I close the attached mail item
4. I try to reopen the attached mail item -> The newInspector event does not fire and I get the error "The operation failed"

I tried to fix the error and reduced more an more code routines:

Following comes the code that produces the error:
--------------------------------------------------------------------------
public void OnStartupComplete(ref System.Array custom)
{
myInspectors = (Outlook.InspectorsClass) applicationObject.Inspectors ;
myInspectors.NewInspector +=new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(myInspectors_NewInspector);
}
private void myInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
object Item = Inspector.CurrentItem;
.....
}
--------------------------------------------------------------------------
When I do the following replacement the error does not appear:
private void myInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
//object Item = Inspector.CurrentItem;
MessageBox.Show("newInspector event fired");
.....
}
--------------------------------------------------------------------------

I think that it has something to do with the release of the underlying COM object.

I use Visual Studio 2003 with .Net Framework 1.1

Any suggestions?

Best regards

Georg
 

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