C# MailItem.MAPIOBJECT question

C

Codex

In C# add-ins for outlook, my understanding is that the
Outlook.MailItem.MAPIOBJECT refers to an IMessage item from which we
can extract the mail headers.

Further, I understand that in other languages, you can use the
QueryInterface method to get the IMessage object from MAPIOBJECT.

C# does not have a QueryInterface method. I've tried typecasting
MAPIOBJECT to CDO.IMessage, but I get a typecast exception.

How do I get the IMessage item from Outlook.MailItem.MAPIOBJECT

Thanks,
-Codex
 
D

Dmitry Streblechenko

MAPIOBJECT returns an Extended MAPI IMessage, not CDO.IMessage. .Net
languages (just like the previous versions of VB) cannot use Extended MAPI.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
D

Dmitry Streblechenko

No, Extended MAPI can only be used from C++ or Delphi, but not from VB.
You can check whether the message has the properties you are after using
MdbView or OutlookSpy (click IMessage).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top