Platform SDK: CDO 1.2.1 |
The ReadFromFile method loads the contents of an attachment from a file.
objAttachment.ReadFromFile(fileName)
The ReadFromFile method replaces the existing contents of the Attachment object, if any.
The ReadFromFile method operates differently, depending on the value of the Attachment object's Type property. The following table describes its operation:
Attachment Type property | ReadFromFile operation |
---|---|
CdoFileData | Copies the contents of the specified file to the attachment. |
CdoFileLink | (Not supported) |
CdoOLE | Reads the attachment from the specified file, which must be in OLE docfile format. The file could have been previously written by the WriteToFile method with an CdoOLE type setting. |
CdoEmbeddedMessage | (Not supported) |
The term "OLE docfile" indicates that the file is written by an application such as Microsoft® Word version 6.0 or later that writes files using the OLE IStorage and IStream interfaces.
Note The current version of CDO does not support ReadFromFile for CdoFileLink or CdoEmbeddedMessage attachments. These calls generate the run-time error CdoE_NO_SUPPORT.
You can load the contents of an attachment when you first create it by specifying the type and source parameters when you call the Add of the Attachments collection.