| Platform SDK: CDO for Windows 2000 |
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);
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.
Dim iMsg as New CDO.Message
Dim iBp as CDO.IBodyPart
Set iBp = iMsg.AddAttachment("c:\report.doc")
iBp.SaveToFile "d:\backup\report.doc"