Platform SDK: MAPI |
The IMAPISession::OpenAddressBook method opens the MAPI integrated address book, returning an IAddrBook pointer for further access.
HRESULT OpenAddressBook( ULONG ulUIParam, LPCIID lpInterface, ULONG ulFlags, LPADRBOOK FAR * lppAdrBook );
The IMAPISession::OpenAddressBook method opens the MAPI integrated address book — a collection of the top-level containers of all of the address book providers in the profile. The pointer that is returned in the lppAdrBook parameter provides further access to the contents of the address book, allowing the caller to perform tasks such as opening individual containers, finding messaging users, and displaying common address dialog boxes.
OpenAddressBook returns MAPI_W_ERRORS_RETURNED if it cannot load one or more of the address book providers in the profile. This value is a warning, not an error value; handle it as you would S_OK. OpenAddressBook always returns a valid pointer in the lppAdrBook parameter, regardless of how many of the address book providers failed to load. Therefore, you must always call the address book's IUnknown::Release method at some point before logging off.
When OpenAddressBook returns MAPI_W_ERRORS_RETURNED, call IMAPISession::GetLastError to obtain a MAPIERROR structure containing information about the failing providers. A single MAPIERROR structure is returned that contains information supplied by all of the providers.