MAPIDeleteMail

The MAPIDeleteMail function deletes a message.

Quick Info

Header file:

MAPI.H

 

ULONG FAR PASCAL MAPIDeleteMail(

    LHANDLE lhSession,

 

    ULONG ulUIParam,

 

    LPTSTR lpszMessageID,

 

    FLAGS flFlags,

 

    ULONG ulReserved

 

   )

 

 

Parameters

lhSession

[in] Session handle that represents a valid Simple MAPI session. The value of the lhSession parameter must represent a valid session; it cannot be zero.

ulUIParam

[in] Parent window handle or zero, indicating that if a dialog box is displayed, it is application modal. If the ulUIParam parameter contains a parent window handle, it is of type HWND (cast to a ULONG). If no dialog box is displayed during the call, ulUIParam is ignored.

lpszMessageID

[in] The identifier for the message to be deleted. This identifier is messaging system-specific and will be invalid when MAPIDeleteMail successfully returns.

flFlags

Reserved; must be zero.

ulReserved

Reserved; must be zero.

 

Return Values

MAPI_E_FAILURE

One or more unspecified errors occurred while deleting the message. No message was deleted.

MAPI_E_INSUFFICIENT_MEMORY

There was insufficient memory to proceed. No message was deleted.

MAPI_E_INVALID_MESSAGE

An invalid message identifier was passed in the lpszMessageID parameter. No message was deleted.

MAPI_E_INVALID_SESSION

An invalid session handle was passed in the lhSession parameter. No message was deleted.

SUCCESS_SUCCESS

The call succeeded and the message was deleted.

 

Remarks

To find the message to be deleted, call the MAPIFindNext1YL.6BX function before calling the MAPIDeleteMail function. Because message identifiers are opaque, messaging system-specific, and can be invalidated at any time, MAPIDeleteMail considers a message identifier to be valid only for the current session. MAPIDeleteMail handles invalid message identifiers by returning the MAPI_E_INVALID_MESSAGE value.

See Also

MAPIFindNext, MAPILogon, MAPISaveMail