Platform SDK: CDO 1.2.1

Type Property (Attachment Object)

The Type property describes the attachment type. Read/write.

Syntax

objAttachment.Type

Data Type

Long

Remarks

The following attachment types are supported:

Type property Value Description
CdoFileData 1 Attachment is the contents of a file. (Default value.)
CdoFileLink 2 Attachment is a link to a file.
CdoOLE 3 Attachment is an OLE object.
CdoEmbeddedMessage 4 Attachment is an embedded message.

The value of the Type property determines the valid values for the Source property. Consequently, you must set Type before setting Source in order for the ReadFromFile and WriteToFile methods to work correctly.

The Type property can also be set at the time of creation of the attachment by supplying the type parameter to the Add method of the Attachments collection.

The Type property corresponds to the MAPI property PR_ATTACH_METHOD. It can be rendered into HTML hypertext using the CDO Rendering ObjectRenderer object. To specify this, set the object renderer's DataSource property to this Attachment object and the property parameter of the RenderProperty method to CdoPR_ATTACH_METHOD.

Example

' from the function Attachments_Add() 
    Set objAttach = objAttachColl.Add ' add an attachment 
    With objAttach 
        .Type = CdoFileLink 
        .Position = 0 ' place at beginning of message 
        .Source = "\\server\bitmaps\honey.bmp" ' UNC name 
    End With 
    ' must update the message to save the new info 
    objOneMsg.Update ' update the message 
    MsgBox "Added an attachment of type CdoFileLink"