IMAPISupport::OpenAddressBook

The IMAPISupport::OpenAddressBook method provides access to the address book.

Quick Info

See IMAPISupport : IUnknownA6YDUA.

HRESULT OpenAddressBook(

    LPCIID lpInterface,

 

    ULONG ulFlags,

 

    LPADRBOOK FAR * lppAdrBook

 

   )

 

 

Parameters

lpInterface

[in] Pointer to the interface identifier (IID) representing the interface to be used to access the address book. Valid values are NULL, indicating the standard address book interface   IAddrBook   and IID_IAddrBook.

ulFlags

Reserved; must be zero.

lppAdrBook

[out] Pointer to a pointer to the address book.

 

Return Values

S_OK

Access to the address book was provided.

MAPI_W_ERRORS_RETURNED

The call succeeded, but one or more address book providers could not be loaded. When this warning is returned, the call should be handled as successful. To test for this warning, use the HR_FAILED macro. See Using Macros for Error Handling3AFTHZP.

 

Remarks

The IMAPISupport::OpenAddressBook method is implemented for all service provider support objects. Service providers, typically tightly coupled message store and transport providers, call the IMAPISupport::OpenAddressBook method to get access to the address book. The returned IAddrBook pointer can be used for a variety of address book tasks, including opening address book containers, finding messaging users, and displaying address dialog boxes.

Notes to Callers

OpenAddressBook can return MAPI_W_ERRORS_RETURNED if it cannot load one or more of the address book providers in the current profile. This value is a warning and you should treat the call as successful. Even if all of the address book providers failed to load, OpenAddressBook still succeeds, returning MAPI_W_ERRORS_RETURNED and an IAddrBook pointer in the lppAdrBook parameter. Because OpenAddressBook always returns a valid IAddrBook pointer, you must release it when you are finished using it.

If one or more address book providers failed to load, call IMAPISupport::GetLastErrorHW29U0 to obtain a MAPIERROR4GS6AI structure containing information about the providers that did not load.

See Also

IAddrBook : IMAPIProp, IMAPISession::OpenAddressBook