views:

33

answers:

2

My program uses MAPI for working with Exchange mailboxes. The problem is if a user fires up Outlook, adds a file as an attachment and also opens Paint, selects a region there, copies it into clipboard and pastes into the message body the resulting message showns two attachments.

More specifically, the program calls IMAPIMessage::GetAttachmentsTable() to retrieve the attachments table and that table contains two objects. Is there a way a program can decide whether the "attachment" is really an attached file or a portion of inline content?

A: 

The property you are looking for is PR_RENDERING_POSITION (0x370B0003). A -1 means that the attachment is a "normal" attachment and not in-line. If the value is anything other than -1, then that indicates an in-line attachment and the value is the position in the body that the attachment should be rendered at.

Here is the MSDN page describing it.


EDIT:

Dmitry, I do not agree with your comment. I have HTML email messages with in-line attachments and the PR_RENDERING_POSITION is working as described in the MSDN page I posted.

Joe Doyle
No, PR_RENDERING_POSITION is only appliable to the RTF messages.It is always -1 for the HTML and text messages.
Dmitry Streblechenko
Could you post a reference to this? MSDN says the opposite, and I have HTML email examples do not agree with you examined using Outlook Spy.
Joe Doyle
The MSDN page does not mention HTML at all.You can change that property using OutlookSpy or MFCMAPI, it won't make any difference for the HTML or TXT messages.
Dmitry Streblechenko
I'd be curious to look at a message like that. Are you sure you are not looking at an RTF message?HTML messages refer to embedded images using the <img> tag, there is no absolute (character wise) image positioning in HTML.
Dmitry Streblechenko
A: 

You will need to check whether the HTML body (through the img tag) refers to the attachment, either through img:cid and PT_ATTACH_CONENTS_ID property or though the file name (PR_ATTACH_LONG_FILENAME) or contnet location (PR_ATTACH_COMTENT_LOCATION).

Dmitry Streblechenko