Share via


Attachments Property

Attachments Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns the collection of attachments in a message. This property is read-only.

Applies To

IAppointment Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

[Visual Basic]Property Attachments As IBodyParts

[C++]HRESULT get_Attachments(IBodyParts** pVal);

Parameters

Remarks

Attachments are stored as body parts in a message's Multipurpose Internet Mail Extensions (MIME) hierarchy. The Attachments property returns a collection of objects that expose the IBodyPart Interface, each of which is deemed to be an attachment by the implementing Component Object Model (COM) class. In most cases, attachments are flagged as such by setting the MIME header Content-Disposition to "attachment." However, a given body part's status as an attachment is implementation-dependent.

For more information about body parts and MIME structures, see Creating MIME-Formatted Messages.

Example

The following code determines the number of attachments in a message:

[Visual Basic]

Dim iMsg As New CDO.Message ' message to be inspected Dim collAtts As CDO.IBodyParts ' attachments collection of message ' ... assume message is valid ... Set collAtts = iMsg.Attachments ' see if there is a collection

If collAtts.Count = 0 Then MsgBox "Attachments collection exists but is empty" Else MsgBox "Message has " & collAtts.Count & " attachments" End If

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.