CMailMessage::GetAttachedFileName Method  
 
BOOL GetAttachedFileName(
  LPTSTR lpszFileName,  
  INT cchFileName  
);
BOOL GetAttachedFileName(
  CString& strFileName  
);

The GetAttachedFileName method returns the file name for the attachment to the current message part.

Parameters

lpszFileName
Pointer to a buffer that will contain the current attachment file name as a string. An alternate form of this method accepts a CString object which will contain the file name when the method returns.
cchFileName
The maximum number of characters that may be copied into the buffer, including the terminating null character.

Return Value

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

Remarks

The method will first try to get the filename from the Content-Disposition header field. If this field does not exist, it then attempts to get the name from the Content-Type header field. If neither field exists, the method will fail.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csmsgv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

AttachFile, GetHeader