Outlook 2003 Beta 2 ItemAdd_Event not triggered properly

  • Thread starter Thread starter Fei Yuan
  • Start date Start date
F

Fei Yuan

Hi Sue,

Here's the information I collected:

Environment: Windows XP with Service Pack 1, Outlook 2003 Beta with
Technical Refresh patched
IDE: Visual Studio .NET 2003 C#
Language: C#, Shared Add-in for Outlook
Event handler: private void OlSentItems_ItemAdd(object Item)
On Items: default "Sent Items" folder's items

Issue: first time I send an email, the event is triggered, but returns me an
item of the following:

---------------------------------
Item: {System.__ComObject} System.Object
- [System.__ComObject] {System.__ComObject} System.__ComObject
- System.MarshalByRefObject {System.__ComObject}
System.MarshalByRefObject
- System.Object {System.__ComObject} System.Object
- __identity <undefined value> System.__ComObject
- m_ObjectToDataMap <undefined value>
System.Collections.Hashtable
- m_wrap 255269088 int
---------------------------------
second time I send an identical email, the event is triggered and returnes
me the correct object:

---------------------------------
Item: {Microsoft.Office.Interop.Outlook.MailItemClass} System.Object
---------------------------------

Please have a look at this issue with the same environment as me since I
believe it is quite an important event in Outlook Object Model. Thanks.


Regards,
- Fei -





------------------------------------------
I don't know the answer to either of your questions. I am trying to find out
more information, so that we can understand this issue better. Knowing the
value of the Class property would help.

Fei Yuan said:
Hi Sue,

I'm not concerned with its class property. What I know is that by sending
the first email, itemAdd event from "Sent Items" returns me a __ComObject
that I cannot cast it to a MailItemClass object. Then for subsequent
emails, "Sent Items" returns me regular MailItemClass objects that are fine.

So my questions are: 1. why did the event returns me a __ComObject at the
first time? 2. if i do check its class property, how do I cast it or
convert it to a MailItemClass?


Regards,
- Fei -



--------------------------------------



I did read your question carefully. I would check the Class property of the
item, not just TypeName to try to understand better what might be happening.
AFAIK, this is not a known issue with 2003.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm


Fei Yuan said:
I'm not talking about meeting request or a task request. I know that I sent
a mail item, but the event wasn't triggered properly. Please read my
question carefully. Thanks.
object
of
back
 
Back
Top