Share via


Attachment Object

Attachment Object

The Attachment object represents a document that is an attachment of a message.

At a Glance

Specified in type library:

CDO.DLL

First available in:

CDO Library version 1.0.a

Parent objects:

Attachments collection

Child objects:

Fields collection

Default property:

Name

Properties

Name

Available since version

Type

Access

Application

1.0.a

String

Read-only

Class

1.0.a

Long

Read-only

Fields

1.1

Field object or Fields collection object

Read-only

Index

1.0.a

Long

Read-only

MAPIOBJECT

1.1

IUnknown object

Read/write (Note: Not available to Visual Basic applications)

Name

1.0.a

String

Read/write

Parent

1.0.a

Attachments collection object

Read-only

Position

1.0.a

Long

Read/write

Session

1.0.a

Session object

Read-only

Source

1.0.a

String or Message object

Read/write

Type

1.0.a

Long

Read/write

Methods

Name

Available since version

Parameters

Delete

1.0.a

(none)

IsSameAs

1.1

objAttach2 as Object

ReadFromFile

1.0.a

fileName as String

WriteToFile

1.0.a

fileName as String

Remarks

An attachment is an object, such as a file or an OLE object, that is associated with and transmitted with a Message object. It is assigned a particular location within the message, specified by the Position property, and overwrites the character at that position when the message is displayed to a messaging user. Typically, a placeholder such as an icon is displayed instead of the attachment's contents, until the user requests that the attachment be opened and displayed in its entirety.

The Microsoft® CDO Library does not manage the actual display of the attachment or its placeholder. The properties of the Attachment object simply provide information which the displaying application can use to find and open the attachment, select a suitable placeholder, and convert the attachment's contents into a display.

An Attachment object can be rendered into HTML hypertext using the CDO Rendering ObjectRenderer object. To specify this, set the object renderer's DataSource property to the Attachment object itself. The individual properties that can be rendered with the RenderProperty method are indicated in the Attachment object property descriptions.