IMessage::DeleteAttach

Applies to: Outlook 2013 | Outlook 2016

Deletes an attachment.

HRESULT DeleteAttach(
ULONG ulAttachmentNum,
ULONG_PTR ulUIParam,
LPMAPIPROGRESS lpProgress,
ULONG ulFlags
);

Parameters

ulAttachmentNum

[in] Index number of the attachment to delete. This is the value for the attachment's PR_ATTACH_NUM (PidTagAttachNumber) property.

ulUIParam

[in] Handle to the parent window of any dialog boxes or windows this method displays. The ulUIParam parameter is ignored unless the ATTACH_DIALOG flag is set in the ulFlags parameter.

lpProgress

[in] Pointer to a progress object that displays a progress indicator. If NULL is passed in lpProgress, the message store provider displays a progress indicator using the MAPI progress object implementation. The lpProgress parameter is ignored unless the ATTACH_DIALOG flag is set in ulFlags.

ulFlags

[in] Bitmask of flags that controls the display of a user interface. The following flag can be set:

ATTACH_DIALOG

Requests the display of a progress indicator as the operation proceeds.

Return value

S_OK

The attachment was successfully deleted.

Remarks

The IMessage::DeleteAttach method deletes an attachment from within a message.

A deleted attachment is not permanently deleted until the message's IMAPIProp::SaveChanges method has been called.

Notes to callers

Before calling DeleteAttach, call the IUnknown::Release method for the attachment and each of its streams.

Because deleting an attachment can be a lengthy process, DeleteAttach provides the mechanism that displays a progress indicator. You can request the display of a progress indicator by passing a pointer to your IMAPIProgress : IUnknown implementation or NULL if you do not have an implementation. You must also specify a window handle in the ulUIParam parameter and the ATTACH_DIALOG flag in the ulFlags parameter.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
AttachmentsDlg.cpp
CAttachmentsDlg::OnDeleteSelectedItem
MFCMAPI uses the IMessage::DeleteAttach method to delete the selected attachment.

See also

IMAPIProp::SaveChanges

IMessage : IMAPIProp

MFCMAPI as a Code Sample