ContactOrganization

Enthält eine Contact Organisation Objekteigenschaften.

Eigenschaften

  • Pref: Legen Sie auf true Wenn dieses ContactOrganization des Benutzers bevorzugten Wert enthält. (boolesch)

  • Typ: eine Zeichenfolge, die angibt, welche Art von Feld in diesem Hause zum Beispiel. _(DOMString)

  • Name: der Name der Organisation. (DOM-String und enthält)

  • Abteilung: die Abteilung, die der Vertrag für arbeitet. (DOM-String und enthält)

  • Titel: Titel des Kontakts in der Organisation. (DOM-String und enthält)

Informationen

Das ContactOrganization -Objekt speichert Organisationseigenschaften eines Kontakts. A Contact -Objekt speichert eine oder mehrere ContactOrganization Objekte in einem Array.

Unterstützte Plattformen

  • Android
  • BlackBerry WebWorks (OS 5.0 und höher)
  • iOS
  • Windows Phone 7 und 8
  • Windows 8

Kleines Beispiel

function onSuccess(contacts) {
    for (var i = 0; i < contacts.length; i++) {
        for (var j = 0; j < contacts[i].organizations.length; j++) {
            alert("Pref: "      + contacts[i].organizations[j].pref       + "\n" +
                "Type: "        + contacts[i].organizations[j].type       + "\n" +
                "Name: "        + contacts[i].organizations[j].name       + "\n" +
                "Department: "  + contacts[i].organizations[j].department + "\n" +
                "Title: "       + contacts[i].organizations[j].title);
        }
    }
};

function onError(contactError) {
    alert('onError!');
};

var options = new ContactFindOptions();
options.filter = "";
filter = ["displayName", "organizations"];
navigator.contacts.find(filter, onSuccess, onError, options);

Vollständiges Beispiel

<!DOCTYPE html>
<html>
  <head>
    <title>Contact Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        var options = new ContactFindOptions();
        options.filter="";
        filter = ["displayName","organizations"];
        navigator.contacts.find(filter, onSuccess, onError, options);
    }

    // onSuccess: Get a snapshot of the current contacts
    //
    function onSuccess(contacts) {
        for (var i = 0; i < contacts.length; i++) {
            for (var j = 0; j < contacts[i].organizations.length; j++) {
                alert("Pref: "     + contacts[i].organizations[j].pref       + "\n" +
                    "Type: "       + contacts[i].organizations[j].type       + "\n" +
                    "Name: "       + contacts[i].organizations[j].name       + "\n" +
                    "Department: " + contacts[i].organizations[j].department + "\n" +
                    "Title: "      + contacts[i].organizations[j].title);
            }
        }
    };

    // onError: Failed to get the contacts
    //
    function onError(contactError) {
        alert('onError!');
    }

    </script>
  </head>
  <body>
    <h1>Example</h1>
    <p>Find Contacts</p>
  </body>
</html>

Android 2.X Macken

  • Pref: von Android 2.X-Geräte, Rückgabe nicht unterstütztfalse.

BlackBerry WebWorks (OS 5.0 und höher) Macken

  • Pref: von BlackBerry-Geräten zurückgeben nicht unterstütztfalse.

  • Typ: von BlackBerry-Geräten zurückgeben nicht unterstütztnull.

  • Name: teilweise unterstützt. Der Name der ersten Organisation wird im Feld Firma BlackBerry gespeichert.

  • Abteilung: nicht unterstützt, Rückgabenull.

  • Titel: teilweise unterstützt. Der erste Titel der Organisation wird im Feld JobTitle BlackBerry gespeichert.

iOS Macken

  • Pref: iOS-Geräten, Rückgabe nicht unterstütztfalse.

  • Typ: iOS-Geräten, Rückgabe nicht unterstütztnull.

  • Name: teilweise unterstützt. Der Name der ersten Organisation wird im Feld kABPersonOrganizationProperty iOS gespeichert.

  • Abteilung: teilweise unterstützt. Die Abteilungsnamen der erste ist im Feld kABPersonDepartmentProperty iOS gespeichert.

  • Titel: teilweise unterstützt. Der erste Titel wird im Feld kABPersonJobTitleProperty iOS gespeichert.