Description
Returns the ids of MAPI messages of a given type.
Syntax
status = MAPIOpenMail(session[, parent][, type][, flags], ids)
Parameters
The MAPIOpenMail function has the following parameters.
Parameter | Description |
---|---|
session | Contains a MAPI session handle returned by MAPILogon. |
parent | Contains the name of an OpenInsight parent window. If not specified any dialog box displayed will be application modal. |
type | Contains the type of messages whose ids are to be returned. A message's type is determined when it is either sent or saved. If not specified the ids of interpersonal mail messages will be returned. Note: Type IPM. returns all interpersonal mail messages. |
flags | Contains information about the type and order of messages returned. It could be MAPI_UNREAD_ONLY$, MAPI_GUARANTEE_FIFO$, or a combination of these flags.
The insert record MAPI_EQUATES contains these flags. You may combine flags by adding them together with an addition sign (+). |
ids | On output contains an @FM-delimited list of ids of the MAPI messages of the given type. Message ids may be used as input to MAPIReadMail, MAPISaveMail and MAPIDeleteMail. |
After the function completes successfully the MAPI message ids are valid so long as this or another application does not move or delete the identified messages .
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(), MAPILogon(), MAPIReadMail(), MAPISaveMail(), MAPIDeleteMail()
Remarks
Subroutine DemoMAPIOpenMail(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