Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

The Resolvemethod matches a Recipient's First and Last names with Contact names in the data store. It looks for complete and partial matches. After finding a match, it sets the Recipient's Nameand Addressproperties.

Syntax

HRESULT Resolve(
   VARIANT_BOOL 
fDisplayUI,
   VARIANT_BOOL * 
pfResolved
);

Parameters

fDisplayUI

[in] If VARIANT_TRUE, Resolvedisplays a dialog box listing all matching e-mail. The user can then select the address for the Contact's Addressproperty. The parent handle for this dialog box is the window handle provided in IPOutlookApp::Logon. If VARIANT_FALSE, Resolvedoes not resolve the address when there is more than one match, and the pfResolved parameter returns VARIANT_FALSE. For information about the VARIANT_BOOLtype, see the union member of the PROPVARIANTstructure.

pfResolved

[out] VARIANT_TRUEif the name resolves properly; VARIANT_FALSEotherwise. For information about the VARIANT_BOOLtype, see the union member of the PROPVARIANTstructure.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

S_OK

The method completed successfully.

Remarks

To get an IPOlRecipientreference, first get a reference to an IRecipientobject and then call IUnknown::QueryInterface. If QueryInterfacefails, the object does not support the interface, so you cannot call Resolve. This check is useful when you want to write code that runs on Windows CE 2.0 in addition to Windows CE 3.0 — only. Windows CE 3.0 and later support the IPOlRecipientinterface.

The VARIANT_BOOLdata type (also known as VT_BOOL) uses the value -1 to represent TRUEand 0 to represent FALSE. It is defined in the wtypes.hheader file in the following manner:

Copy Code
typedef short 
VARIANT_BOOL;

A common programming error occurs when, for readability purposes, you want to set a VARIANT_BOOLvalue to TRUEor FALSE. You can achieve the same effect by using the aliases VARIANT_TRUEand VARIANT_FALSE, which are also defined in the wtypes.hheader file.

Copy Code
#define 
VARIANT_TRUE  ((VARIANT_BOOL)0xffff)
#define 
VARIANT_FALSE ((VARIANT_BOOL)0)

If more than one Contactitem matches the recipient, then the Contact Chooserappears, prompting the user to select the correct Contact item.

On Windows Mobile Standard, IPOlRecipient::Resolvereturns E_NOTIMPL.

Code Example

The following code example demonstrates how to resolve a recipient.

Note:
To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
Copy Code
void ResolveName(IRecipients * pRecipientList)
{
	IRecipient	* pRecip;
	IPOlRecipient * pRecip2;
	BSTR			pwsz;

	pRecipientList->Add(TEXT("Tom"), &pRecip);

	// Call QueryInterface to get the IPOlRecipient interface.
	pRecip->QueryInterface(IID_IPOlRecipient,
(LPVOID*)&pRecip2);

	// Resolve the name.
	pRecip2->Resolve();

	// You can examine the Address with either pRecip or
pRecip2--they both point to the same object.
	// pRecip->get_Address(&pwsz);
	pRecip2->get_Address(&pwsz);

	// Free resources.
	SysFreeString(pwsz);

	pRecip2->Release();
	pRecip->Release();
}

Requirements

Header pimstore.h
Library Pimstore.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also