How to cancel new inspector event

J

jonatan.hortelano

Hi all,

I'm developing an addin in c#.

I'm trying to do the following:

When the user opens the email (double-clicks on it) I want to capture
the event to display a windows form instead of the Outlook standard
compose form when certain data is in the Billing information of the
message.

To accomplish this, I'm doing the following

1) Capture the new inspector event.
2) Open my form

The problem I have is that Outlook opens the compose form as well.

I tried to close the inspector using Inspector.Close but it does not
work.

Is there any way to cancel the opening of the inspector? Is there any
other way of doing that?

This is my code:

public void OnStartupComplete(ref System.Array custom)
{
....
applicationObject.Inspectors.NewInspector +=new
Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
}

private void Inspectors_NewInspector(Outlook.Inspector Inspector)
{

Outlook._MailItem oMailItem = (Outlook._MailItem)
Inspector.CurrentItem;

if (oMailItem.BillingInformation == "test")
{
MessageBox.Show("This is a test item");

Inspector.Close(Outlook.OlInspectorClose.olSave);

openMyForm();
}
}


Thank you

Jonatan
 

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