Platform SDK: CDO for Windows 2000

SaveToFile Method

The SaveToFile method saves the decoded contents of a body part to a disk file.

[Visual Basic]
Sub SaveToFile(ByVal FileName as String)
[C++]
HRESULT SaveToFile(BSTR FileName);
[IDL]
HRESULT SaveToFile([in] BSTR FileName);

Parameters

FileName
The full path and file name to be used for the Uniform Resource Locator (URL) for the disk file.

Remarks

Local drive formats are supported. For local drive files, you can use the File:// prefix; thus, the URL arguments File://C:\foo.txt and C:\foo.txt are both valid and function identically.

HTTP:// and FTP:// locations are not supported.

Example

Dim iMsg as New CDO.Message
Dim iBp as CDO.IBodyPart
Set iBp = iMsg.AddAttachment("c:\report.doc")
iBp.SaveToFile "d:\backup\report.doc"