Applies to: Outlook 2013 | Outlook 2016

Enables the calling service provider or gateway to add properties to the encapsulation of a message or an attachment.

  ULONG ulFlags,
  ULONG ulElemID,
  LPVOID lpvData,
  LPSPropTagArray lpPropList



[in] A bitmask of flags that controls how properties are included in or excluded from encapsulation. The following flags can be set:


Encodes only the properties in the lpPropList parameter that are part of attachments in the message.


Encodes only properties from the attachment specified by the ulElemID parameter. If the lpvData parameter is not NULL, the data pointed to is written into the attachment's encapsulation in the file indicated by the PR_ATTACH_TRANSPORT_NAME (PidTagAttachTransportName) property.


Encodes only properties from the message or attachment specified by the ulElemID parameter. If this flag is set, the value in lpvData must be an IStream pointer.


Encodes all properties not specified in the lpPropList parameter.


Encodes all properties specified in lpPropList.


Encodes only those properties specified in lpPropList that are part of the message itself.


[in] An attachment's PR_ATTACH_NUM (PidTagAttachNumber) property, which contains a number that uniquely identifies the attachment in its parent message. The ulElemID parameter is used when special handling is requested for an attachment. The ulElemID parameter should be 0 unless the TNEF_PROP_CONTAINED or TNEF_PROP_CONTAINED_TNEF flag is set in the ulFlags parameter.


[in] A pointer to attachment data used to replace the data of the attachment specified in ulElemID. The lpvData parameter should be NULL unless TNEF_PROP_CONTAINED or TNEF_PROP_CONTAINED_TNEF is set in ulFlags.


[in] A pointer to the list of properties to include in or exclude from encapsulation.

Return value


The call succeeded and has returned the expected value or values.


Transport providers, message store providers, and gateways call the ITnef::AddProps method to list properties to be included in or excluded from the Transport-Neutral Encapsulation Format (TNEF) processing of a message or an attachment. By using successive calls, the provider or gateway can specify a list of properties to add and encode or to exclude from being encoded. Providers and gateways can also use AddProps to provide information about any special handling attachments should be given.

AddProps is supported only for TNEF objects that are opened with the TNEF_ENCODE flag for the OpenTnefStream or OpenTnefStreamEx function.

Note that no actual TNEF encoding happens for AddProps until the ITnef::Finish method is called. This functionality means that pointers passed into AddProps must remain valid until after the call to Finish is made. At that point, all objects and data passed in with AddProps calls can be released or freed.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
MFCMAPI uses the ITnef::AddProps method to copy properties from a message to a TNEF stream.

See also




PidTagAttachTransportName Canonical Property

ITnef : IUnknown

MFCMAPI as a Code Sample