Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii friends,
I am customising my outlook. I have created my outlook addin and added an custom button which when clicked opens up an outlooks new mail form using the below code.
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMailItem.Display(true);

Now, I want to capture the send item click event and do some operations only if the user opens up a new mail form by clicking on my custom button, rather than opening directly a outlook new email button in the tool bar.
Outlook.Application oApp = new Outlook.Application();
oApp.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);
The above code helps me to capture the send item click event when placed in ThissAddin.cs , but it also runs for entire application whenever the user click on the send email button which I should not allow.
Can anyone help me with how to acheive this ?
Thanks in advance.
T.Sudhir

What I have tried:

Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Application oApp = new Outlook.Application();
oApp.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);
oMailItem.Display(true);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900