IPOlRecipient::Resolve (Compact 7)

3/12/2014

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 pfResolvedparameter 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.

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)

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

See Also

Reference

IPOlRecipient
IRecipient
IRecipients
Pocket Outlook Object Model Interfaces