Contacts
The contacts object provides functions for creating and finding contacts.
Supported Platform(s)
| - BlackBerry 10 |
| API | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
|---|---|---|---|---|---|---|---|
| blackberry.pim.contacts.create | Y | ||||||
| blackberry.pim.contacts.find | Y |
Configuration Document Settings
|
To use all of the API described for this object, you must ensure the following settings are in your configuration document: |
|
You must declare the feature element(s) below in your configuration document: |
| Feature ID | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
|---|---|---|---|---|---|---|---|
| <feature id="blackberry.pim.contacts" /> | Y |
| Permission Elements (PlayBook and BlackBerry 10+) |
|---|
| You must declare the permission element(s) below in your configuration document: |
|
- <rim:permit>access_pimdomain_contacts</rim:permit>
Permits your app to access contacts. |
Functions
static
blackberry.pim.contacts.Contact
blackberry.pim.contacts.create
([properties : Object])
Returns a new Contact object. This method does not persist the Contact object to the device contacts database. To persist the Contact object to the device, invoke the Contact.save method.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| properties |
Optional object literal that specifies the field values for the Contact object. The object should be in the following form (with any number of properties):
{
displayName: <display name - String>,
name: <name - ContactName>,
nickname: <nickname - String>,
phoneNumbers: <phone numbers - ContactField[]>,
emails: <email addresses - ContactField[]>,
addresses: <addresses - ContactAddress[]>,
ims: <IM addresses - ContactField[]>,
organizations: <organization - ContactOrganization[]>,
birthday: <birthday - Date>,
note: <note - String>,
photos: <photos - ContactField[]>,
categories: <user defined categories - ContactField[]>,
urls: <web pages - ContactField[]>
}
|
Code Example:
|
static
void
blackberry.pim.contacts.find
(contactFields : String[], findOptions : blackberry.pim.contacts.ContactFindOptions, onFindSuccess : function, [onFindError : function])
Queries the device contacts database. The search results are passed to the onFindSuccess callback function specified by the onFindSuccess parameter.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| contactFields | A String array of contact fields to be used as search qualifier. Only these fields will have values in the resulting Contact objects. |
| findOptions | Options to be applied to the search. |
| onFindSuccess |
Success callback function that is invoked with the contacts returned from the contacts database.
contacts: The array of Contact objects from the search. |
| onFindError |
Optional error callback function. Invoked when error occurs. Possible errors are: permission denied error (if access_pimdomain_contacts is not specified) or illegal arguments error (if mandatory parameters are missing or invalid).
error: The blackberry.pim.contacts.ContactError object which contains the error code. |
Code Example:
|
Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 18:15:36 GMT-0500 (EST)