Platform SDK: MAPI |
The IMAPISupport::OpenAddressBook method provides access to the address book.
HRESULT OpenAddressBook( LPCIID lpInterface, ULONG ulFlags, LPADRBOOK FAR * lppAdrBook );
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.
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 containing information about the providers that did not load.