Platform SDK: MAPI

Opening the Address Book

Call IMAPISession::OpenAddressBook to open the integrated address book and retrieve a pointer to the MAPI IAddrBook interface. The methods of the IAddrBook interface can be used to access entries in all of the containers of each of the address book providers in the profile.

OpenAddressBook might return a warning, MAPI_W_ERRORS_RETURNED, to indicate that there were problems with one or more of the address book providers. Interactive clients should call IMAPISession::GetLastError to retrieve additional error information and display the returned information the first time they call OpenAddressBook and it returns a warning.

Noninteractive clients should ignore the warning and proceed as if the method succeeded. The returned IAddrBook interface is valid regardless of whether all of the address book providers in the profile are running, some of them, or none of them. Therefore, both interactive and noninteractive clients must always remember to release the IAddrBook pointer when the session ends.