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