Logon Method

Microsoft Outlook Visual Basic

Show All

Logon Method

       

Logs the user on to MAPI, obtaining a MAPI session.

expression.Logon(Profile, Password, ShowDialog, NewSession)

expression    An expression that returns a NameSpace object.

Profile   Optional Variant. The profile name, as a String, to use for the session.

Password   Optional Variant. The password (if any), as a String, associated with the profile.

ShowDialog   Optional Variant. True to display the MAPI logon dialog.

NewSession   Optional Variant. True to create a new session (doesn't use an existing session). Multiple sessions cannot be created in Outlook.

Example

This Visual Basic for Applications example uses the Logon method to log on to a new session, displaying the dialog box to verify the profile name and password.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
myNameSpace.Logon "myProfile", "myPassword", True, True