Dela via


SaveToFile Method

Topic Last Modified: 2006-06-13

Saves the decoded contents of a body part to a disk file.

Applies To

IBodyPart Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Function SaveToFile(    FileName As String)
HRESULT SaveToFile
(
        BSTR FileName
);

Parameters

  • FileName
    The full path and file name to be used for the URL for the disk file.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Local drive and File Transfer Protocol (FTP) formats are supported. For local drive files you can use the "File://" prefix, thus the URL argument File://C:\mytext.txt and C:\mytext.txt are both legal and function identically.

"HTTP://" 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"