PRB: ReadFromFile() Fails for Attachment of Type CdoOle (196080)
The information in this article applies to:
- Collaboration Data Objects (CDO) 1.1
- Collaboration Data Objects (CDO) 1.2
- Collaboration Data Objects (CDO) 1.21
This article was previously published under Q196080 SYMPTOMS
If a bitmap attachment has the type CdoOLE, the attachment can be written to a file on disk with the WriteToFile method without an error occurring. However, when you try to use the ReadFromFile method of an attachment object to read a bitmap file from the disk into a message where CdoOLE is the attachment type, you will get one of the following error messages, depending on the version of CDO (1.1, 1.2, 1.21):
Run-time error '-2147221233 (8004010f)'
[Collaboration Data Objects - [MAPI_E_NOT_FOUND (8004010F)]]
- or -
Run-time error '-2147467259(80004005)'
[Collaboration Data Objects - [E_FAIL(8000405)]]
The code provided in the "More Information" section below illustrates that the error will occur even if you have previously written the file from an Attachment object with the WriteToFile method.
CAUSE
Bitmap files are not in OLE docfile format. If the Type property of the Attachment object is CdoOLE, the file specified in the ReadFromFile method must be in OLE docfile format. 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.
RESOLUTION
Specify CdoFileData (1) for the Type property of the Attachment or use Microsoft Outlook to insert the bitmap.
STATUS
This behavior is by design. CDO (1.1, 1.2, 1.21) documenation states that the CdoOle file must be an OLE Doc file, not just a OLE file.
Modification Type: | Minor | Last Reviewed: | 3/4/2004 |
---|
Keywords: | kbMsg kbprb KB196080 |
---|
|