MimeExtractFile Function  
 
BOOL WINAPI MimeExtractFile(
  HMESSAGE hMessage,  
  LPCTSTR lpszFileName  
);

The MimeExtractFile function extracts a file attachment from the current message part and stores it on the local system.

Parameters

hMessage
Handle to the message.
lpszFileName
A pointer to a null-terminated string which specifies the name of a file on the local system.

Return Value

If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call MimeGetLastError.

Remarks

This function will store the contents of a file attachment in the current message part to the specified file on the local system. If a path is specified as part of the file name, it must exist and the current user must have the appropriate permissions to create the file. If a file with the same name already exists, it will be overwritten with the contents of the attachment. If the file attachment was encoded using base64 or uuencode, this function will automatically decode the contents of the attachment.

To determine if the current message part contains a file attachment, use the MimeGetAttachedFileName function.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csmsgav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

MimeAttachFile, MimeExportMessage, MimeExtractFileEx, MimeGetAttachedFileName, MimeImportMessage