IMessage::OpenAttach
Published: July 16, 2012
Opens an attachment.
HRESULT OpenAttach( ULONG ulAttachmentNum, LPCIID lpInterface, ULONG ulFlags, LPATTACH FAR * lppAttach );
To open an attachment, you must have access to its attachment number or PR_ATTACH_NUM property. Call IMessage::GetAttachmentTable to retrieve the message's attachment table and locate the row that represents the attachment to be opened. See Opening an Attachment for more information.
Do not try to open one attachment multiple times; the results are undefined and dependent on the message store provider.
You can request that the attachment be opened in read/write mode, instead of the default read-only mode. However, whether the attachment will actually be opened in read/write mode is up to the message store provider. You can either attempt to modify the attachment, preparing to handle possible failure, or check the level of access that was granted by retrieving the attachment's PR_ACCESS_LEVEL (PidTagAccessLevel) property, if it is available.