MAPIResolveName (VB)

The Visual Basic MAPIResolveName function transforms a message recipient's name as entered by a user to an unambiguous address list entry.

Quick Info

Header file: MAPIVB32.BAS

MAPIResolveName(

    Session as Long,
    UIParam as Long,
    UserName as String,
    Flags as Long,
    Reserved as Long,
    
Recipient as MapiRecip) as Long

Parameters

Session
[in] Session handle that represents a Simple MAPI session or zero. If the value of the Session parameter is zero, MAPI logs on the user and creates a session that exists only for the duration of the call. This temporary session can be an existing shared session or a new one. If necessary, a logon dialog box is displayed.
UIParam
[in] Parent window handle or zero, indicating that if a dialog box is displayed, it is application modal. If no dialog box is displayed during the call, the UIParam parameter is ignored.
UserName
[in] The name to be resolved.
Flags
[in] Bitmask of option flags. The following flags can be set:
MAPI_AB_NOMODIFY
The caller is requesting that the dialog box be read-only, prohibiting changes. MAPIResolveName ignores this flag if MAPI_DIALOG is not set.
MAPI_DIALOG
A dialog box should be displayed for name resolution. If this flag is not set and the name cannot be resolved, MAPIResolveName returns the MAPI_E_AMBIGUOUS_RECIPIENT value.
MAPI_LOGON_UI
A dialog box should be displayed to prompt the user to log on if required. When the MAPI_LOGON_UI flag is not set, the client application does not display a logon dialog box and returns an error value if the user is not logged on.
MAPI_NEW_SESSION
An attempt should be made to create a new session rather than acquire the environment's shared session. If the MAPI_NEW_SESSION flag is not set, MAPIResolveName uses an existing shared session.
Reserved
Reserved; must be zero.
Recipient
[out] A recipient-type set returned by MAPIResolveName if the resolution results in a single match. The type contains the recipient information of the resolved name. The descriptor can then be used in calls to the MAPISendMail, MAPISaveMail, and MAPIAddress functions.

Return Values

MAPI_E_AMBIGUOUS_RECIPIENT
The recipient requested has not been or could not be resolved to a unique address list entry.
MAPI_E_FAILURE
One or more unspecified errors occurred. The name was not resolved.
MAPI_E_INSUFFICIENT_MEMORY
There was insufficient memory to proceed. The name was not resolved.
MAPI_E_LOGIN_FAILURE
There was no default logon, and the user failed to log on successfully when the logon dialog box was displayed. The name was not resolved.
MAPI_E_NOT_SUPPORTED
The operation was not supported by the underlying messaging system.
MAPI_E_USER_ABORT
The user canceled the resolution. The name was not resolved.
SUCCESS_SUCCESS
The call succeeded and the name was resolved.

Remarks

The MAPIResolveName function resolves a message recipient's name (as entered by a user) to an unambiguous address list entry, optionally prompting the user to choose between possible entries, if necessary. A recipient descriptor containing fully resolved information about the entry is allocated and returned.

The declaration of this function for the 32-bit Visual Basic runtime is:

MAPIResolveName(

ByVal Session&,
ByVal UIParam&,
ByVal UserName$,
ByVal Flags&,
ByVal Reserved&,
Recipient As MapiRecip) As Long