ContactsManager

class OC\ContactsManager
Source:lib/private/ContactsManager.php#34
Implements:OCP\Contacts\IManager

Properties

Methods

public OC\ContactsManager::search($pattern, $searchProperties=[], $options=[])
This function is used to search and find contacts within the users address books.
In case $pattern is empty all contacts will be returned.
Source:

lib/private/ContactsManager.php#48

Parameters:
  • $pattern (string) which should match within the $searchProperties
  • $searchProperties (array) defines the properties within the query pattern should match
  • $options (array) = array() to define the search behavior
  • ‘escape_like_param’ - If set to false wildcards _ and % are not escaped
  • ‘limit’ - Set a numeric limit for the search results
  • ‘offset’ - Set the offset for the limited search results
Returns:

array an array of contacts which are arrays of key-value-pairs

public OC\ContactsManager::delete($id, $address_book_key)
This function can be used to delete the contact identified by the given id
Source:

lib/private/ContactsManager.php#71

Parameters:
  • $id (object) the unique identifier to a contact
  • $address_book_key (string) identifier of the address book in which the contact shall be deleted
Returns:

bool successful or not

public OC\ContactsManager::createOrUpdate($properties, $address_book_key)
This function is used to create a new contact if ‘id’ is not given or not present.
Otherwise the contact will be updated by replacing the entire data set.
Source:

lib/private/ContactsManager.php#92

Parameters:
  • $properties (array) this array if key-value-pairs defines a contact
  • $address_book_key (string) identifier of the address book in which the contact shall be created or updated
Returns:

array representing the contact just created or updated

public OC\ContactsManager::isEnabled()
Check if contacts are available (e.g. contacts app enabled)
Source:lib/private/ContactsManager.php#110
Returns:bool true if enabled, false if not
public OC\ContactsManager::registerAddressBook($addressBook)
Source:

lib/private/ContactsManager.php#117

Parameters:
public OC\ContactsManager::unregisterAddressBook($addressBook)
Source:

lib/private/ContactsManager.php#124

Parameters:
public OC\ContactsManager::getAddressBooks()
Return a list of the user’s addressbooks display names
! The addressBook displayName are not unique, please use getUserAddressBooks
Source:lib/private/ContactsManager.php#136
Returns:\OCP\IAddressBook[]
Since:6.0.0
Deprecated:16.0.0 - Use `$this->getUserAddressBooks()` instead
public OC\ContactsManager::getUserAddressBooks()
Return a list of the user’s addressbooks
Source:lib/private/ContactsManager.php#152
Returns:\OCP\IAddressBook[]
Since:16.0.0
public OC\ContactsManager::clear()
removes all registered address book instances
Source:lib/private/ContactsManager.php#160
public OC\ContactsManager::register($callable)
In order to improve lazy loading a closure can be registered which will be called in case
address books are actually requested
Source:

lib/private/ContactsManager.php#181

Parameters:
  • $callable (Closure)
protected OC\ContactsManager::getAddressBook($addressBookKey)
Get (and load when needed) the address book for $key
Source:

lib/private/ContactsManager.php#191

Parameters:
  • $addressBookKey (string)
Returns:

\OCP\IAddressBook

protected OC\ContactsManager::loadAddressBooks()
Load all address books registered with ‘register’
Source:lib/private/ContactsManager.php#203