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
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