IMimeMessage::AttachObject method
Attaches an object to the message. The data source of the message attachment is a Component Object Model (COM) object.
Syntax
HRESULT AttachObject(
[in] REFIID riid,
[in] void *pvObject,
[out] LPHBODY phBody
);
Parameters
-
riid [in]
-
Type: REFIID
Specifies the type of object that pvObject points at. Valid values include:
-
(IID_IStream)
-
(IID_ILockBytes)
-
(IID_IMimeBody)
-
(IID_IMimeMessage)
-
(IID_IMimeWebDocument)
-
-
pvObject [in]
-
Type: void*
Specifies a pointer to the object in which to create the attachment. 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 |
---|---|
|
Indicates success. |
|
Indicates that an unknown error has occurred. |
|
Indicates that riid or pvObject is NULL. |
|
Indicates that an attempt to allocate memory failed. |
Remarks
This method creates the attachment in the multipart/mixed section of the message. It creates a multipart/mixed section if one does not exist.
Data in the object that pvObject points to must be stored in either IET_BINARY or IET_DECODED type. For more information, see ENCODINGTYPE.
This method sets the PID_HDR_CNTDISP property of the new body to "attachment".
After successfully calling this method, a client should use phBody to set the PID_HDR_CNTTYPE property to a value that corresponds to the type of data stored in pvObject.
Requirements
Minimum supported client |
Windows XP [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Product |
Outlook Express 6.0 |
Header |
|
IDL |
|
DLL |
|