ITnef::OpenTaggedBody

Applies to: Outlook 2013 | Outlook 2016

Opens a stream interface on the text of an encapsulated message.

HRESULT OpenTaggedBody(
  LPMESSAGE lpMessage,
  ULONG ulFlags,
  LPSTREAM FAR * lppStream
);

Parameters

lpMessage

[in] A pointer to the message with which the stream is associated. This message is not required to be the same message that is passed in the call to the OpenTnefStream or OpenTnefStreamEx function.

ulFlags

[in] A bitmask of flags that controls how the stream interface is opened. The following flags can be set:

MAPI_CREATE

If a property does not exist in the current message, it should be created. If the property does exist, the current data in the property should be replaced with the data from the Transport-Neutral Encapsulation Format (TNEF) stream. When an implementation sets the MAPI_CREATE flag, it should also set the MAPI_MODIFY flag.

MAPI_MODIFY

Requests read/write permission. The default interface is read-only. MAPI_MODIFY must be set whenever MAPI_CREATE is set.

lppStream

[out] A pointer to a pointer to a stream object that contains the text from the PR_BODY (PidTagBody) property of the passed-in encapsulated message and that supports the IStream interface.

Return value

S_OK

The call succeeded and returned the expected value or values.

Remarks

Transport providers, message store providers, and gateways call the ITnef::OpenTaggedBody method to open a stream interface on the text of an encapsulated message (that is, on a TNEF object).

As part of its processing, OpenTaggedBody either inserts or parses attachment tags that indicate the position of any attachments or OLE objects in the message text. The attachment tags are in the following format:

[[ attachment name : n in attachment container name ]]

attachment name describes the attachment object; n is a number that identifies the attachment that is part of a sequence, incrementing from the value passed in the lpKey parameter of the OpenTnefStream or OpenTnefStreamEx function; and attachment container name describes the physical component where the attachment object resides.

OpenTaggedBody reads out message text and inserts an attachment tag wherever an attachment object originally appeared in the text. The original message text is not changed.

When a message that has tags is passed to a stream, the tags are stripped out and the attachment objects are relocated in the position of the tags in the stream.

See also

OpenTnefStream

OpenTnefStreamEx

PidTagBody Canonical Property

ITnef : IUnknown