Last modified: July 23, 2011

Applies to: Outlook

Returns the message's attachment table.

HRESULT GetAttachmentTable(
  ULONG ulFlags,


[in] Bitmask of flags that relate to the creation of the table. The following flag can be set:


The string columns are in Unicode format. If the MAPI_UNICODE flag is not set, the string columns are in ANSI format.


Allows GetAttachmentTable to return successfully, possibly before the table is fully available to the calling client. If the table is not available, making a subsequent call to it can cause an error.


[out] Pointer to a pointer to the attachment table.


The attachment table was successfully retrieved.

The IMessage::GetAttachmentTable method returns a pointer to the message's attachment table, which includes information about all of the attachments in the message. Clients can get access to an attachment only through the attachment table. By retrieving an attachment's number its PR_ATTACH_NUM (PidTagAttachNumber) property a client can use several of the IMessage methods to work with the attachment.

There is one row for each attachment. For a complete list of the columns in an attachment table, see Attachment Tables.

An attachment usually does not appear in the attachment table until both the attachment and the message have been saved with a call to IMAPIProp::SaveChanges. Attachment tables are dynamic. If a client creates a new attachment, deletes an existing attachment, or changes one or more properties once the SaveChanges calls have been made on the attachment on the message, the attachment table will be updated to reflect the new information.

Some attachment tables support a wide variety of restrictions; others do not. Support for restrictions depends on the message store provider's implementation.

When initially opened, attachment tables are not necessarily sorted in any particular order.

Setting the MAPI_UNICODE flag in the ulFlags parameter affects the following calls to the attachment table:

Setting the Unicode flag requests that the information for any string columns returned from these calls be in Unicode format. However, because not all message store providers support Unicode, setting this flag is only a request.