Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MAPIOBJECT and Delphi - please help

100 views
Skip to first unread message

Joel Brinkman

unread,
Jul 1, 2001, 1:39:39 PM7/1/01
to
I seem to be having some trouble getting the IMessage

interface on a mail item object. It seems like it should be pretty

straight-forward but given an IDispatch to a mail item I've gotten

a _MailItem interface (which works fine) and with that I've tried

to get the IMessage interface through the MAPIOBJECT property of the

_MailItem. Unfortunately, I can't seem to get a valid interface!

I've even tried creating a TMessage (from the CDO import) and

calling ConnectTo with the IMessage. (I realize that I had already

established that IMessage was not working, but I went through the

exercise anyway.) Any input on what I'm doing wrong would be

appreciated.

Regards,

Joel

Dmitry Streblechenko

unread,
Jul 1, 2001, 1:58:25 PM7/1/01
to
MAPIOBJECT on an Outlook item is an IMessage *Extended MAPI* interface.
The following works fine for me
var Msg : IMessage;
...
Msg:=IUnknown(Item.MAPIOBJECT) as IMessage;
or
if S_OK = IUnknown(Item.MAPIOBJECT).QueryInterface(IMessage, Msg) then...

If your code runs in a separate (from Outlook) process or in a thread that you
have created, you must initialize MAPI first by calling MAPIInitialize(...)
before you access any Extended MAPI interfaces, including the sample above. Call
MAPIUninitialize() when you are done.

Extended MAPI headers for Delphi are available on my site - see my signature
(click OutlookSpy, then Resources).

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

"Joel Brinkman" <joel.b...@remooove.j3ee.com> wrote in message
news:OSIaQVlABHA.1268@tkmsftngp07...

Joel Brinkman

unread,
Jul 1, 2001, 2:43:03 PM7/1/01
to
Dmirty! I'm sorry I didn't look through your site earlier! You've got a
lot
of extremely valuable info up there. I now have the interface (I found that
my interface definition was messed up once I looked at your header
conversion.) The only thing that I could use now is an example of GetProps
but I think I might be able to figure that out if you don't have one handy.

Again, thanks very much!

Regards,
Joel


"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message
news:OzdDcdlABHA.1412@tkmsftngp07...

0 new messages