ContactAddress

The ContactAddress 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,
      ContactAddress = contacts.ContactAddress;

  var homeAddress = {
           "type": ContactAddress.HOME,
           "streetAddress": "123 Abc Rd",
           "locality": "Waterloo",
           "region": "Ontario",
           "country": "Canada"
     };
  var workAddress = {
           "type": ContactAddress.WORK,
           "streetAddress": "456 Industry St",
           "locality": "Waterloo",
           "region": "Ontario",
           "country": "Canada"
      };

  var newContact = contacts.create();
  newContact.name = {
      "givenName": "Bart",
      "familyName": "Simpson"
  };
  newContact.addresses = [homeAddress, workAddress];

  newContact.save(onSaveSuccess, onSaveError);
}

function onSaveSuccess(contact) {
    alert("Contact saved: " + contact.name.givenName);
}

function onSaveError(error) {
    alert("Contact save failed: " + error.code);
}
      
Constants:
String country
String locality
String postalCode
String region
String streetAddress
String streetOther
String type
Constants:
String HOME
String OTHER
String WORK

country

The country name.

Synopsis:

String ContactAddress.country

locality

The city or locality.

Synopsis:

String ContactAddress.locality

postalCode

The postal code or zip code.

Synopsis:

String ContactAddress.postalCode

region

The province, state, or region.

Synopsis:

String ContactAddress.region

streetAddress

The street address.

Synopsis:

String ContactAddress.streetAddress

streetOther

Extra information about the street address.

Synopsis:

String ContactAddress.streetOther

type

Specifies the type of ContactAddress.

Synopsis:

String ContactAddress.type

HOME

The type of ContactAddress is "home".

Synopsis:

constant
String ContactAddress.HOME = "home"

OTHER

The type of ContactAddress is "other".

Synopsis:

constant
Number ContactAddress.OTHER = "other"

WORK

The type of ContactAddress is "work".

Synopsis:

constant
String ContactAddress.WORK = "work

Last modified: 2014-05-14



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

comments powered by Disqus