ContactPhoto

The ContactPhoto object contains the address information of a Contact object.

Installation:

To use this API in your project, add the contacts plugin:

webworks plugin add com.blackberry.pim.contacts

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);
      }
      </script>
      
Properties:
String largeFilePath
String originalFilePath
Boolean pref
String smallFilePath

largeFilePath

Contains the large photo file path.

Synopsis:

String ContactPhoto.largeFilePath

originalFilePath

Contains the file path of the original contact photo.

Synopsis:

String ContactPhoto.originalFilePath

pref

If true, this ContactPhoto contains the user's preferred value.

Synopsis:

Boolean ContactPhoto.pref

smallFilePath

Contains the small photo file path.

Synopsis:

String ContactPhoto.smallFilePath

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus