Compartir a través de


SaveToFile Method

SaveToFile Method

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

Syntax

Sub SaveToFile(ByVal FileName as String)
HRESULT SaveToFile(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"