Send Feedback

The OpenAttach method opens an attachment.


HRESULT OpenAttach (
  ULONG ulAttachmentNum,
  LPCIID lpInterface,
  ULONG ulFlags,
  LPATTACH FAR * lppAttach


  • ulAttachmentNum
    [in] Index number of the attachment to open, specified by the lpulAttachmentNum parameter of IMessage::CreateAttach from when the attachment was created.
  • lpInterface
    [in] Ignored.
  • ulFlags
    [in] Ignored.
  • lppAttach
    [out] Reference to the open attachment.

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.


To open an attachment, you must have access to its attachment number. Call GetAttachmentTable to retrieve the message's attachment table and locate the row that represents the attachment to be opened.

Do not try to open one attachment multiple times; the results are undefined and dependent on the message store provider.

Attachments are always in the read/write mode.


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.