Avaya Client SDK

< Back to Package Overview

Contacts API

Overview

Retrieve an instance of the Contacts API from the Client Session object using:

var contacts = clientSession.createContacts();  

The Contacts object

Methods

Check if the enterprise directory service is available

To check if the contacts service is available for search features use the following method. The availability of the contacts service is also reported via the onContactsAvailable and onContactsUnavailable events.

contacts.isContactsServiceAvailable();

Search the enterprise directory

Search the enterprise directory (LDAP) for contacts. This method should only be executed if the connection to the contacts service is available, otherwise the search will fail and be reported via the onContactsSearchFailed event. Results are returned asynchronously via the onContactsSearchCompleted event.

var searchRequest = contacts.search(searchString, maxResults);

Cancel an enterprise directory search

To cancels the currently active search use the following method.

contacts.cancelSearch();

Listening for Contacts API Events

As API requests are asynchronous, it is necessary to create callbacks to listen out for events triggered. For more information on events see the API reference documentation.

contacts.addOnContactsAvailableCallback(callback);
contacts.addOnContactsUnavailableCallback(callback);
contacts.addOnContactsSearchResultsUpdatedCallback(callback);
contacts.addOnContactsSearchFailedCallback(callback);
contacts.addOnContactsSearchCompletedCallback(callback);