Source Property (CDONTS Attachment Object)

The Source property returns or sets information specifying the location of the data for the attachment. Read/write (read-only for an attachment on a message in the Inbox).

Syntax

objAttach.Source 
 

Data Type

String or Object (Message)

Remarks

The Source property is not used for CdoFileData attachments. For CdoEmbeddedMessage attachments, the Source property returns or sets the Message object to be embedded. An embedded message is copied into the attachment at creation time.

Note  The Source property is a string except when it returns the source of a CdoEmbeddedMessage attachment.

The return value or setting of the Source property depends on the value of the Type property, as described in the following table:

Type property Source property
CdoFileData Not used; contains an empty string. The source for this type of attachment must be specified in the call to the Add method.
CdoEmbeddedMessage Specifies the Message object to be embedded.

Note  You must set Type before you set Source. Failure to do this can result in a return of CdoE_NOT_FOUND from the ReadFromFile or WriteToFile method.

The Source property can also be set at the time of creation of the attachment by supplying the source parameter to the Add method of the Attachments collection. For attachments of type CdoFileData, the Add method is the only place the source file can be specified. However, you can reset it later with the Attachment object's ReadFromFile method.