Share via


IMAPISupport::OpenAddressBook

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 page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Provides access to the address book.

HRESULT OpenAddressBook(
LPCIID lpInterface,
ULONG ulFlags,
LPADRBOOK FAR * lppAdrBook
);

Parameters

  • lpInterface
    [in] A pointer to the interface identifier (IID) that represents the interface to be used to access the address book. Valid values are NULL, which indicates the standard address book interface IAddrBook, and IID_IAddrBook.

  • ulFlags
    Reserved; must be zero.

  • lppAdrBook
    [out] A pointer to a pointer to the address book.

Return Value

  • 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. For more information, see Using Macros for Error Handling.

Remarks

The IMAPISupport::OpenAddressBook method is implemented for all service provider support objects. Service providers, typically tightly coupled message store and transport providers, call OpenAddressBook 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::GetLastError to obtain a MAPIERROR structure that contains information about the providers that did not load.

See Also

Reference

IAddrBook : IMAPIProp

IMAPISession::OpenAddressBook

IMAPISupport : IUnknown