Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IMessage::CreateAttach

Creates a new attachment.

HRESULT CreateAttach(
LPCIID lpInterface,
ULONG ulFlags,
ULONG FAR * lpulAttachmentNum,
LPATTACH FAR * lppAttach
);

Parameters

lpInterface

[in] Pointer to the interface identifier (IID) representing the interface to be used to access the message. Passing NULL results in the message's standard interface, or IMessage, being returned.

ulFlags

[in] Bitmask of flags that controls how the attachment is created. The following flag can be set:

MAPI_DEFERRED_ERRORS

Allows CreateAttach to return successfully, possibly before the attachment is fully accessible to the calling client. If the attachment is not accessible, making a subsequent call to it can result in an error.

lpulAttachmentNum

[out] Pointer to an index number identifying the newly created attachment. This number is valid only when the message is open and is the basis for the attachment's PR_ATTACH_NUM (PidTagAttachNumber) property.

lppAttach

[out] Pointer to a pointer to the open attachment object.

S_OK

The attachment was successfully created.

The IMessage::CreateAttach method creates a new attachment on a message. The new attachment and any properties that are set for it, are not available until a client has called both the attachment's IMAPIProp::SaveChanges method and the message's IMAPIProp::SaveChanges method.

The attachment number pointed to by lpulAttachmentNum is unique and valid only within the context of the message. That is, two attachments in two different messages can have the same number while two attachments in the same message cannot.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.