Description
Deletes messages from MAPI message storage.
Syntax
status = MAPIDeleteMail([session] [, parent], ids)
Parameters
The MAPIDeleteMail function has the following parameters.
Parameter | Description |
---|---|
session | Contains a MAPI session handle returned by MAPILogon. If not specified a system default session will be initiated, if possible, or a sign-in dialog box will be displayed. In any case, MAPI will return to its previous state upon completion of the function. |
parent | Contains the name of an OpenInsight parent window. If not specified any dialog box displayed will be application modal. |
ids | Contains an @FM-delimited list of ids of the MAPI messages to be deleted. Message ids are returned by MAPIOpenMail and MAPISaveMail. |
After the function completes successfully the MAPI message ids are no longer valid.
Returns
1 for successful execution or 0 for failure.
If function execution fails, you can retrieve a text error message by calling the Get_Status function. For example, to display an error message on the screen, include the following error handling routine in your code:
Get_Status(ErrMsg) Msg(@window, ErrMsg)
See also
Get_Status(), MAPIOpenMail(), MAPISaveMail()
Example
Subroutine DemoMAPIDeleteMail(var) * Delete archived messages $INSERT MAPI_EQUATES Declare Function MAPILogon, MAPIOpenMail, MAPIDeleteMail, | MAPILogoff Declare Subroutine Msg, Get_Status if MAPILogon(session) then if MAPIOpenMail(session, 0, "IPM.Archive", 0, ids) then if MAPIDeleteMail(session, 0, ids) then Msg(@window, "Archived messages deleted") end else Get_Status(display) Msg(@window, display) end end else Get_Status(display) Msg(@window, display) end if MAPILogoff(session) else Get_Status(display) Msg(@window, display) end end else Get_Status(display) Msg(@window, display) end return