Send Feedback

The CreateAttach method creates a new attachment.


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


  • lpInterface
    [in] Ignored.
  • ulFlags
    [in] Ignored.
  • lpulAttachmentNum
    [out] Reference to an index number identifying the newly created attachment. This number is valid only when the message is open.
  • lppAttach
    [out] Reference to the open attachment object.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    Indicates success.


When CreateAttach is called, the new attachment and any properties that are set for it are available immediately.

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.


Pocket PC: Pocket PC 2002 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: mapidefs.h
Library: cemapi.lib

See Also

IMessage | Messaging

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.