PC Review


Reply
Thread Tools Rate Thread

C# MailItem.MAPIOBJECT question

 
 
Codex
Guest
Posts: n/a
 
      19th Aug 2003
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
 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      19th Aug 2003
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


"Codex" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      20th Aug 2003
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


"Codex" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dmitry,
>
> Thanks. If I was writing in VC++ or Visual Basic, however, I'd be
> able to get at and use this Extended MAPI object. Is that right?
>
> I'm trying to access this so that I can get at the message-ID's and
> the "in reply to" field of the headers. I read one posting suggesting
> that these won't exist for email sent among MS exchange servers. Is
> that correct?
>
> - Codex
>
> "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message

news:<(E-Mail Removed)>...
> > 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
> >
> >
> > "Codex" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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



 
Reply With Quote
 
New Member
Join Date: Dec 2006
Posts: 1
 
      6th Dec 2006
And is there any way i can pass MAPIOBJECT from C# to C++(unmanaged), maybe write a dll and pass MAPIOBJECT to a function as a parameter?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: MailItem Find Method question Dmitry Streblechenko Microsoft Outlook VBA Programming 2 23rd Feb 2010 04:38 PM
Re: MailItem Find Method question Michael Bauer [MVP - Outlook] Microsoft Outlook VBA Programming 0 22nd Feb 2010 09:40 AM
How can I create a MailItem that displays like a received MailItem ? Clive Microsoft Outlook Form Programming 0 27th Feb 2006 04:14 PM
MailItem.ReceivedTime question? Yonah Sudwerts Microsoft Outlook VBA Programming 1 6th Dec 2004 04:28 AM
MailItem send method question John Smith Microsoft Outlook Form Programming 2 2nd Nov 2004 11:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:41 AM.