Capturing the send event of Outlook 2003
Hello ,
I am trying to capture the Outlook 2003 Send event. I have used a Add-in project to do the required.
Since outlook.MailItem does not have a send event i have used a delegate to declare a send event and call the event.
But i think i am going wrong somewhere bcoz when i try to debug the project line by line the delegate does not get debugged. Can anyone plz tell me where am i going wrong ?
--- In the Class area ,declared the following objects:----
public Outlook.Application OutlookApplication;
public Outlook.Inspectors OutlookInspectors;
public Outlook.Inspector OutlookInspector;
public Outlook.MailItem OutlookMailItem;
public delegate void ApplicationEvents_11_ItemSendEventHandler(object Item, ref bool Cancel);
----- In the OnConnection function: ---------
applicationObject = application;
addInInstance = addInInst;
OutlookApplication = application as Outlook.Application;
OutlookInspectors = OutlookApplication.Inspectors;
OutlookInspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(OutlookI nspectors_NewInspector);
OutlookApplication.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler( OutlookMailItem_Send);
----- in the OutlookMailItem_Send function --------
string strchkTo = OutlookMailItem.To;
string strchk = "hello Welcome to c#";
---- In the OutlookInspectors function --------
OutlookInspector = (Outlook.Inspector)Inspector;
if (Inspector.CurrentItem is Outlook.MailItem)
{
OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
}
|