IMimeMessageW::AttachFileW method

Attaches the contents of a file to the message.

Syntax

HRESULT AttachFileW(
  [in]  LPCWSTR pwszFilePath,
  [in]  IStream *pstmFile,
  [out] LPHBODY phBody
);

Parameters

pwszFilePath [in]

Type: LPCWSTR

Specifies the path and filename of the file to attach. When pstmFile is NULL, pwszFilePath is used to indicate the file to attach, in which case the file must exist and MimeOLE must have read access to it. Otherwise, pwszFilePath is used only to indicate the filename of the attached file, which might not exist.

pstmFile [in]

Type: IStream*

Specifies a pointer to the IStream object for the file to attach. MimeOLE increments the reference count for this object and does not release it until the whole message object is freed or until HandsOffStorage is called.

phBody [out]

Type: LPHBODY

Receives the handle of the new body.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Indicates success.
E_FAIL
Indicates that an unknown error has occurred.
E_INVALIDARG
Indicates that pwszFilePath is NULL.
E_OUTOFMEMORY
Indicates an attempt to allocate memory failed.

Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Product
Outlook Express 6.0
Header
Mimeole.h
IDL
Mimeole.idl
DLL
Inetcomm.dll (version 6.0 or later)