Addressbook Functions — This section describes functions to use the addressbook for user and e-mail address lookups.
resource mapi_openaddressbook(mapisession $session);
resource mapi_ab_openentry(resource $addrbook,
string $entryid,
long $flags);
array mapi_ab_resolvename(resource $addrbook,
array $name_entry);
string mapi_ab_getdefaultdir(resource $addrbook);
resource mapi_openaddressbook(mapisession $session)
Opens the MAPI Addressbook. On Zarafa, this only is the Global Addressbook, containing the Zarafa users.
This function will return a MAPI Addressbook resource when successfull, or FALSE on failure.
resource mapi_ab_openentry(resource $addrbook, string $entryid, long $flags)
Calls the OpenEntry() function on the Addressbook object.
This function performs the OpenEntry() call on the AddressBook interface. Returns FALSE on failure, otherwise an MailUser, DistList or ABContainer is returned as resource.
array mapi_ab_resolvename(resource $addrbook, array $name_entry)
Calls the ResolveName() function on the Addressbook object.
This function performs the ResolveName() call on the AddressBook interface.
This function returns MAPI_E_AMBIGUOUS_RECEIP or MAPI_E_NOT_FOUND when these errors occurred, or FALSE on any other error. When the user is found, the array returned has the full information of the user requested.
Example 3.66. Resolving a user to e-mail address
$addrbook = mapi_openaddressbook($session); $user = array( array( PR_DISPLAY_NAME => 'steve' ), array( PR_DISPLAY_NAME => 'milo' ) ); $user = mapi_ab_resolvename($addrbook, $user); print_r($user);
Output:
Array ( [0] => Array ( [805437470] => SMTP [805371934] => Steve Hardy [956301315] => 0 [805503006] => steve@connectux.com [268370178] => ... [267780354] => ... [268304387] => 6 [267976962] => ... [806027522] => SMTP:STEVE@CONNECTUX.COM ) [1] => Array ( [805437470] => SMTP [805371934] => Milo Oostergo [956301315] => 0 [805503006] => milo@connectux.com [268370178] => ... [267780354] => ... [268304387] => 6 [267976962] => ... [806027522] => SMTP:MILO@CONNECTUX.COM ) )
string mapi_ab_getdefaultdir(resource $addrbook)
Calls the GetDefaultDir() function on the Addressbook object.
This function performs the GetDefaultDir() call on the AddressBook interface.
This function returns an EntryID on success, FALSE on error.