IAddrBook::ResolveName
Published: July 16, 2012
Performs name resolution, assigning entry identifiers to recipients in a recipient list.
HRESULT ResolveName( ULONG_PTR ulUIParam, ULONG ulFlags, LPSTR lpszNewEntryTitle, LPADRLIST lpAdrList );
Clients and service providers call the ResolveName method to initiate the name resolution process. An unresolved entry is an entry that does not yet have an entry identifier or PR_ENTRYID (PidTagEntryId) property.
ResolveName goes through the following process for each unresolved entry in the address list passed in the lpAdrList parameter.
-
If the address type of the recipient adheres to the format of an SMTP address (displayname@domain.top-level-domain), ResolveName assigns it a one-off entry identifier.
-
For each container in the PR_AB_SEARCH_PATH (PidTagAbSearchPath) property, ResolveName calls the IABContainer::ResolveNames method. ResolveNames tries to match the display name of each unresolved recipient with a display name that belongs to one of its entries.
-
If a container does not support ResolveNames, ResolveName restricts the container's contents table by using a PR_ANR (PidTagAnr) property restriction. This restriction causes the container to perform a "best guess" type of search to locate a matching recipient. All containers must support the PR_ANR property restriction.
-
When a container returns a recipient that matches multiple names, ResolveName displays a dialog box if the MAPI_DIALOG flag is set, which lets the user select the correct name.
-
If all of the containers in the PR_AB_SEARCH_PATH property have been called and no match has been found, the recipient remains unresolved.
If one or more recipients are unresolved, ResolveName returns MAPI_E_NOT_FOUND. If one or more recipients had ambiguous resolution that could not be resolved with a dialog box, or because the MAPI_DIALOG flag was not set, ResolveName returns MAPI_E_AMBIGUOUS_RECIP. When some of the recipients are ambiguous and some cannot be resolved, ResolveName can return either error value.
If a name cannot be resolved, the client can create a one-off address that has a specially formatted address and entry identifier. For more information about the format of one-off entry identifiers, see One-Off Entry Identifiers. For more information about the format of one-off addresses, see One-Off Addresses.
MAPI supports Unicode character strings for the ADRLIST and the new entry title parameters to ResolveName; if you set the MAPI_UNICODE flag, the following properties are returned as type PT_UNICODE in the ADRENTRY structures:
-
PR_ADDRTYPE (PidTagAddressType)
-
PR_DISPLAY_NAME (PidTagDisplayName)
-
PR_EMAIL_ADDRESS (PidTagEmailAddress)
-
PR_TRANSMITABLE_DISPLAY_NAME (PidTagTransmittableDisplayName)
However, the PR_7BIT_DISPLAY_NAME (PidTag7BitDisplayName) property is always returned as type PT_STRING8.
For MFCMAPI sample code, see the following table.
|
File |
Function |
Comment |
|---|---|---|
|
MAPIABFunctions.cpp |
AddOneOffAddress |
MFCMAPI uses the ResolveName method to resolve a one-off address before adding it to a message. |
|
MAPIABFunctions.cpp |
AddRecipient |
MFCMAPI uses the ResolveName method to look up an address book entry by display name. |