Partager via


IPOlRecipient::Resolve

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The Resolve method 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 Name and Address properties.

Syntax

HRESULT Resolve(
   VARIANT_BOOL fDisplayUI,
   VARIANT_BOOL * pfResolved
);

Parameters

  • fDisplayUI
    [in] If VARIANT_TRUE, Resolve displays a dialog box listing all matching e-mail. The user can then select the address for the Contact's Address property. The parent handle for this dialog box is the window handle provided in IPOutlookApp::Logon. If VARIANT_FALSE, Resolve does not resolve the address when there is more than one match, and the pfResolved ** parameter returns VARIANT_FALSE. For information about the VARIANT_BOOL type, see the union member of the PROPVARIANT structure.
  • pfResolved
    [out] VARIANT_TRUE if the name resolves properly; VARIANT_FALSE otherwise. For information about the VARIANT_BOOL type, see the union member of the PROPVARIANT structure.

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 IPOlRecipient reference, first get a reference to an IRecipient object and then call IUnknown::QueryInterface. If QueryInterface fails, 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 IPOlRecipient interface.

The VARIANT_BOOL data type (also known as VT_BOOL) uses the value -1 to represent TRUE and 0 to represent FALSE. It is defined in the wtypes.h header file in the following manner:

typedef short VARIANT_BOOL;

A common programming error occurs when, for readability purposes, you want to set a VARIANT_BOOL value to TRUE or FALSE. You can achieve the same effect by using the aliases VARIANT_TRUE and VARIANT_FALSE, which are also defined in the wtypes.h header file.

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

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

On Windows Mobile Standard, IPOlRecipient::Resolve returns 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.

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

Tasks

Creating a Meeting Request

Reference

IPOlRecipient
IRecipient
IRecipients
Pocket Outlook Object Model Interfaces