次の方法で共有


ITnef::AddProps

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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

HRESULT AddProps(
  ULONG ulFlags,
  ULONG ulElemID,
  LPVOID lpvData,
  LPSPropTagArray lpPropList
);

Parameters

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

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

    • TNEF_PROP_CONTAINED
      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.

    • TNEF_PROP_CONTAINED_TNEF
      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.

    • TNEF_PROP_EXCLUDE
      Encodes all properties not specified in the lpPropList parameter.

    • TNEF_PROP_INCLUDE
      Encodes all properties specified in lpPropList.

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

  • ulElemID
    [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.

  • lpvData
    [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.

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

Return Value

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

Remarks

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

File.cpp

SaveToTNEF

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

See Also

Reference

ITnef::Finish

OpenTnefStream

OpenTnefStreamEx

PidTagAttachTransportName Canonical Property

ITnef : IUnknown

Concepts

MFCMAPI as a Code Sample