Re: MailItem.Send event (not the method)
- From: "Ken Slovak - [MVP - Outlook]" <kenslovak@xxxxxxxx>
- Date: Thu, 7 Sep 2006 10:09:12 -0400
I'd probably use code something like this (VS 2005, C#):
private Outlook.MailItem m_Mail;
m_Mail = Outlook.MailItem;
m_Mail.Send += new Microsoft.Office.Interop.Outlook.ItemEvents_10_SendEventHandler(m_Mail.Send);
I'd declare m_mail at a module level of a class that won't go out of scope so it won't get garbage collected. I might also add it to a hashtable to keep it alive.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"jamiec" <jamiec@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:15B809A1-BE4B-4FA2-93F4-41E9C6C263D5@xxxxxxxxxxxxxxxx
Hello,
Can someone who is knowledgeable in this area help me with this? Perhaps
those MVPs know how to use MailItem.Send event correctly in C#.
Thanks
"jamiechen168@xxxxxxxxx" wrote:
Hello,
I am using .NET C# with VS 2005 for Outlook automation.
Can someone explain me how to use MailItem.Send event correctly?
What I discovered is MailItem inherits ItemEvents_10_Event interface
and _MailItem interface and both have "Send" defined. And _MailItem's
Send obscures ItemEvents_10_Event's Send.
MailItem
|
+ ItemEvents_10_Event (where "Send" is defined as an event) <= This
is what I need
+ _MailItem (where "Send" is defined as a method)
Even if I try to cast MailItem to ItemEvents_10_Event, I got a null for
it. Below is the example code,
// Below outLookEvent will turn to be null.
Outlook.ItemEvents_10_Event outLookEvent =
(Outlook.ItemEvents_10_Event) mailItem;
outLookEvent.Send += new .....
Does anyone ever use MailItem.Send event successfully?
Thanks
.
- Prev by Date: Re: Track a specific email is sent
- Next by Date: Re: MailItem.Send event (not the method)
- Previous by thread: Reference to the mailitem the user has chosen
- Next by thread: Re: MailItem.Send event (not the method)
- Index(es):
Relevant Pages
|