다음을 통해 공유


Attachments Property (IAppointment)

Topic Last Modified: 2006-06-13

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

Property Attachments As IBodyParts
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:


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