This API is available on Firefox OS for privileged or certified applications only.
Summary
The getAll method is used to access a sorted list of contact from the device's contact database. This method is best suited to access a large data set, where find() is better suited for a small data set.
Syntax
var instanceOfDomCursor = window.navigator.mozContacts.getAll(options);
Parameters
- options
- The getAll method expects some options to sort and filter the contacts. The possible options are the following:
 Sort options- sortBy: A string representing the field by which the results of the search are sorted. Currently only- givenNameand- familyNameare supported.
- sortOrder: A string indicating the result's sort order. Possible values are- descendingor- ascending.
 - filterBy: An array of strings representing all the fields to filter by.
- filterValue: The value to match against.
- filterOp: The filter comparison operator to use. Possible values are- equals,- startsWith, and- match, the latter being specific to telephone numbers.
- filterLimit: The number of contacts to retrieve.
 
Return value
A DOMCursor object to handle the success or error of the operation. In case of success, the request's result is a mozContact object. To move to the next result, call the cursor's continue() method.
Example
var filter = {
  sortBy: familyName,
  sortOrder: ascending,
  filterBy: ['familyName'],
  filterValue: 'a',
  filterOp: startsWith
}
var request = window.navigator.mozContacts.getAll(filter);
var count = 0;
request.onsuccess = function () {
  if(this.result) {
    count++;
    // Display the name of the contact
    console.log(this.result.givenName + ' ' + this.result.familyName);
    // Move to the next contact which will call the request.onsuccess with a new result
    this.continue();
  } else {
    console.log(count + 'contacts found.');
  }
}
request.onerror = function () {
  console.log('Something goes wrong!');
}
Specifications
| Specification | Status | Comment | 
|---|---|---|
| Contacts Manager API The definition of 'Contacts Manager API' in that specification. | Working Draft | |
| vCard Format Specification | IETF RFC | RFC 6350 | 
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari | 
|---|---|---|---|---|---|
| basic support | No support | No support | No support | No support | No support | 
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | 
|---|---|---|---|---|---|---|
| basic support | No support | No support | 18.0 | No support | No support | No support | 
See also
Document Tags and Contributors
    
    Tags: 
    
  
                    
                       Contributors to this page: 
        chrisdavidmills, 
        Sebastianz, 
        fscholz, 
        kollishivagangadhar, 
        Mte90, 
        kscarfone, 
        Jeremie
                    
                    
                       Last updated by:
                      chrisdavidmills,