Group:  Microsoft Outlook ยป microsoft.public.outlook.interop
Thread: MailItem.Send event (not the method)

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

MailItem.Send event (not the method)
jamiechen168[ at ]gmail.com 26.08.2006 00:32:47
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

RE: MailItem.Send event (not the method)
jamiec 07.09.2006 09:23:01
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[ at ]gmail.com" wrote:

[Quoted Text]
> 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
>
>
Re: MailItem.Send event (not the method)
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 07.09.2006 14:09:12
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[ at ]discussions.microsoft.com> wrote in message
news:15B809A1-BE4B-4FA2-93F4-41E9C6C263D5[ at ]microsoft.com...
[Quoted Text]
> 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[ at ]gmail.com" 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
>>
>>

Re: MailItem.Send event (not the method)
"Brian Tillman" <tillman1952[ at ]yahoo.com> 07.09.2006 14:13:42
jamiec <jamiec[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
> 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#.

You'd be more likely to to encounter those knowledgeable people in a
programming group like
news://msnews.microsoft.com/microsoft.public.outlook.program_vba
--
Brian Tillman

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net