Platform SDK: MAPI

Attachments

Some message store providers allow clients to associate added information in the form of files, OLE objects, messages, or binary data with messages. This added information is called a message's attachment. Because attachments are created, maintained, and accessed only through their messages, they are considered message subobjects. Rather than having an entry identifier for access, attachments have a sequential number known as an attachment number. This number uniquely identifies the attachment within its message, but not necessarily within the message store. Two different messages can have different attachments with the same attachment number. Attachment numbers are only valid as long as the message is open and are stored in the PR_ATTACH_NUM property.

To access summary information about all of a message's attachments, clients retrieve its attachment table. The attachment table includes information that clients can use to access an attachment directly, such as its attachment number and record key. Clients can retrieve an attachment table by:

Message store providers are expected to support both of these approaches. The OpenProperty approach requires that the caller specify IID_IMAPITable as the interface identifier and PR_MESSAGE_ATTACHMENTS as the property tag. PR_MESSAGE_ATTACHMENTS is a table object property that represents a message's attachment table. Message store providers are required to set PR_MESSAGE_ATTACHMENTS for each message and include it in the array of property tags returned from the IMAPIProp::GetPropList method.

PR_MESSAGE_ATTACHMENTS can be used:

For more information, see Attachment Tables.