Description

Begins a session with the MAPI messaging system.

Syntax

status = MAPILogon(session[, parent][, user][, password][, flags])

Parameters

The MAPILogon function has the following parameters.

ParameterDescription
sessionOn output contains the handle of a session with the MAPI messaging system.
parentContains the name of an OpenInsight parent window. If not specified any dialog box displayed will be application modal.
userContains the name of the MAPI client account to be logged on.
passwordContains the password of the MAPI client account to be logged on.
flagsContains information about session initiation and message downloading. It could be MAPI_LOGON_UI$, MAPI_NEW_SESSION$, MAPI_FORCE_DOWNLOAD$, or a combination of these flags.
  • MAPI_LOGON_UI$ indicates that MAPI should display a sign-in dialog box, if necessary.
  • MAPI_NEW_SESSION$ indicates that MAPI should establish a new session and not attempt to share another MAPI client's session or the default session.
  • MAPI_FORCE_DOWNLOAD$ indicates that all new messages should be downloaded to the user's inbox.

The insert record MAPI_EQUATES contains these flags. You may combine flags by adding them together with an addition sign (+).

After the function completes successfully the session parameter will contain a valid MAPI session handle which may then be used as input to further MAPI function calls.

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()MAPILogoff()

Example

Subroutine DemoMAPILogon(var)
*      Logs on to MAPI and logs off
$INSERT MAPI_EQUATES
Declare Function MAPILogon, MAPILogoff
Declare Subroutine Msg, Get_Status
if MAPILogon(session) then
  if MAPILogoff(session) then
    Msg(@window, "Logon and logoff successful")
  end else
    Get_Status(display)
    Msg(@window, display)
  end
end else
  Get_Status(display)
  Msg(@window, display)
end
return
  • No labels