Skip Navigation

METHOD_SearchDirectory

Use this method to search for contacts in a supported directory service (for example, 
Microsoft Active Directory
 and Directory Access). 
The following table describes the parameters that you can include in this method.
Parameter
Type
Required
Description
keySearch
String
This parameter specifies the search term in the query. 
typeSearch
String
This parameter specifies the field to search (for example, first name, last name, display name, and email address).
dependencies
String
This parameter specifies the other methods that this method is dependent on. It specifies the comma delimited dependent request IDs.

BEMS
 response and notification

The following table describes the parameters that 
BEMS
 returns and the notification to send to the 
BlackBerry Connect
 app when the user searches a directory for contacts.
Parameter
Type
Description
method
String
This parameter specifies the invoked method (for example, SearchDirectory). 
state
String
This parameter specifies the state of the request to 
BEMS
 (for example, Processing or Complete). 
contacts
Object
This parameter displays the contact details of the returned contacts.
maxResults
Integer
This parameter lists the number of contacts that match the directory search query.
totalResolved
Integer
This parameter specifies the number of contacts that are returned for the search query.
searchTerm
String
This parameter is the search term by which the directory is queried.

Code example

The following example sends a request to 
BEMS
 to search the directory for all contacts that have the letters "sa" included in their name.
{ "id":"c5", "method":"DirectorySearch", "params": { "keySearch":"sa", "typeSearch":"name" }, "jsonrpc":"2.0" }
If the search request is successful, 
BEMS
 sends the following response to the 
BlackBerry Connect
 app.
{ "id":"c5", "error":null, "result": { "data": { "method":"SearchDirectory", "state":"PROCESSING" } }, jsonrpc":"2.0", "backgrouond":true }
If there are no errors, 
BEMS
 sends the following notification to the 
BlackBerry Connect
 app and displays the contacts that match the search query.
{ "id": "c19", "sequence":1018538100000020, "result": { "data": { "contacts": { "sip:useram9@example.com": { "uri":"sip:usersam9@example.com", "email":"usersam9@example.com", "personalMessage": "", "displayName":"user 9", "title":"", "workPhone":"", "mobilePhone":"", "availability":"-2", "presence":"No
BEMS-Connect
Presence", "isAllowedToShowPhoto":false, "photoHash":"PENDING", "groups":[], "containerId":"0", "container":"default", "type":"self", "numDevices":"1" } }, "maxResults":"50", "totalResolved":"50", "searchTerm":"sa", "method":"SearchDirectory", "state":"COMPLETE" }