ContactPhoto
The ContactPhoto object contains the address information of a Contact object.
Code Example:
function createContact() {
var contacts = blackberry.pim.contacts;
// access_shared permission is needed to access shared folder
var primaryPhoto = {
originalFilePath: blackberry.io.sharedFolder + "/photos/contact.jpg",
pref: true
};
var secondaryPhoto = {
originalFilePath: blackberry.io.sharedFolder + "/photos/other.jpg",
pref: false
};
var newContact = contacts.create();
newContact.name = {
"givenName": "Lisa",
"familyName": "Simpson"
};
newContact.photos = [primaryPhoto, secondaryPhoto];
newContact.save(onSaveSuccess, onSaveError);
}
function onSaveSuccess(contact) {
alert("Contact saved: " + contact.name.givenName);
alert("Small primary photo: " + contact.photos[0].smallFilePath);
}
function onSaveError(error) {
alert("Contact save failed: " + error.code);
}
|
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+) |
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.
|
Properties
readonly
String
largeFilePath
Contains the large photo file path
Supported Platforms
|
|
- BlackBerry 10
|
String
originalFilePath
Contains the file path of the original contact photo.
Supported Platforms
|
|
- BlackBerry 10
|
Boolean
pref
If true, this ContactPhoto contains the user's preferred value.
Supported Platforms
|
|
- BlackBerry 10
|
readonly
String
smallFilePath
Contains the small photo file path.
Supported Platforms
|
|
- BlackBerry 10
|
Documentation generated by
JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 18:15:36 GMT-0500 (EST)