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);
}


Supported Platform(s)

- BlackBerry 10
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
largeFilePath           Y 
originalFilePath           Y 
pref           Y 
smallFilePath           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 IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<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

String largeFilePath
String originalFilePath
Boolean pref
String smallFilePath

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 Mon Feb 11 2013 14:51:05 GMT-0500 (EST)