IMimeMessage::GetAttachments method

Gets an array of attachments for the message.

Syntax

HRESULT GetAttachments(
  [out] ULONG   *pcAttach,
  [out] LPHBODY *pprghAttach
);

Parameters

pcAttach [out]

Type: ULONG*

Receives a pointer to a ULONG that contains the number of attachments.

pprghAttach [out]

Type: LPHBODY*

Receives a pointer to an array of attachment body handles. pcAttach contains the size of the array. The client is responsible for freeing this pointer by calling IMalloc::Free.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Indicates success.
E_FAIL
Indicates that an unknown error has occurred.
E_INVALIDARG
Indicates that pcAttach is NULL.
E_OUTOFMEMORY
Indicates that an attempt to allocate memory failed.

Remarks

A body in the message cannot be returned as an attachment if it meets any of the following criteria.

  • The body has a multipart/* Content-Type.
  • The body is empty (for example, if IsType(IBT_EMPTY) returns S_OK).
  • The client is hiding Transport Neutral Encapsulation Format (TNEF) attachments and the body's Content-Type is equal to application/ms-tnef.
  • The body has not been rendered, or it has been rendered and auto-inlined. The PID_ATT_RENDERED property is used to determine whether a body has been rendered and the PID_ATT_AUTOINLINED property is used to determine whether a body has been auto-inlined. Rendering a message using the IMimeMessage::CreateWebPage method sets these properties. A client renders a message and then calls IMimeMessage::GetAttachments to get all the bodies that were not presented to the user. When a client renders a body (for example, using IMimeMessage::GetTextBody), it should set the PID_ATT_RENDERED property to TRUE so that the body does not show up as an attachment.

Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Product
Outlook Express 6.0
Header
Mimeole.h
IDL
Mimeole.idl
DLL
Inetcomm.dll (version 6.0 or later)