ExtractFile Method  
 

Extract the contents of a file attachment and store it on the local system.

Syntax

object.ExtractFile( FileName, [MessagePart] )

Parameters

FileName
A string which specifies the name of the file that the attachment will be written to. If the file does not exist, it will be created. If the file exists, it will be overwritten.
MessagePart
An optional integer value that specifies the message part number that contains the file attachment. If this parameter is omitted, the method will extract the file attachment in the current message part.

Return Value

A value of zero is returned if the action was successful. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The ExtractFile method writes the contents of a message part, typically a file attachment, to a file on the local system. This method will automatically decode any binary file attachments. To determine if the current message part contains a file attachment, check the value of the Attachment property.

See Also

Attachment Property, AttachData Method, AttachFile Method, ExtractAllFiles Method, FindAttachment Method