View Full Version : Catch the event when Mail is sent from Outlook


apondu
03-14-2006, 06:16 AM
Hi,

I am working on outlook and building an ADD-IN for outlook using
C#.Net.

I wanted to catch the event whenever a mail is sent using the outlook
and popup a messagebox showing whether to continue sending the mail or
not. I want to do it using c#.net and i am not interested by any
features (if present) of outlook that would make the task easy.

I tried using the following code but there was an error

outlook.application applicationObject = null

and code the following

public void OnStartupComplete(ref System.Array custom)
{
try
{
applicationObject.ItemSend += new
outlook.ApplicationEvents_11_ItemSendEventHandler(mailButtoon_Click);

}
catch(Exception error)
{
messagebox(error.message.tostring());
}

public void mailButton_Click(object item, ref Bool Cancel)
{
messagebox.show("Sending Message");
}


This code gives an error sometimes saying mailButton_Click without
paranthesis and sometimes won't trigger when the event occurs and if it
is triggered is gives a error message saying "No Such Interface
Supported"

Can anyone help me in this and if possible a code snippet to do this
task

I am creating a Add-In

Thanks for the help

Regards,
Govardhan