Share via


IMessage::DeleteAttach

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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

Reference

IMAPIProp::SaveChanges

IMessage : IMAPIProp

Concepts

MFCMAPI as a Code Sample