KnownContactField class

This topic has not yet been rated - Rate this topic

A static class that contains the names of contact fields for storing commonly requested information like email address and phone numbers.

Syntax


var knownContactField = Windows.ApplicationModel.Contacts.KnownContactField;

Attributes

MarshalingBehaviorAttribute(Agile)
StaticAttribute(Windows.ApplicationModel.Contacts.IKnownContactFieldStatics, NTDDI_WIN8)
VersionAttribute(NTDDI_WIN8)

Members

The KnownContactField class has these types of members:

Methods

The KnownContactField class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
ConvertNameToType Converts a string representing the name of a field to its corresponding type.
ConvertTypeToName Converts the type of a field to its corresponding string name.

 

Properties

The KnownContactField class has these properties.

PropertyAccess typeDescription

Email

Read-onlyContains the name of the field used for email addresses.

InstantMessage

Read-onlyContains the name of the field used for instant messaging accounts.

Location

Read-onlyContains the name of the field used for the contact's location.

PhoneNumber

Read-onlyContains the name of the field used for phone numbers.

 

Remarks

The KnownContactField class is designed for use as a parameter with the DesiredFields property of the ContactPicker. It allows apps to clearly specify what fields to retrieve from contact providers.

Examples

This example demonstrates how to use the KnownContactField class.


function selectKnownFields() {
    var picker = Windows.ApplicationModel.Contacts.ContactPicker();
    picker.commitButtonText = "Select";
    picker.selectionMode = Windows.ApplicationModel.Contacts.ContactSelectionMode.fields;
    picker.desiredFields.append(Windows.ApplicationModel.Contacts.KnownContactField.email);
    picker.desiredFields.append(Windows.ApplicationModel.Contacts.KnownContactField.instantMessage);
    picker.desiredFields.append(Windows.ApplicationModel.Contacts.KnownContactField.location);
    picker.desiredFields.append(Windows.ApplicationModel.Contacts.KnownContactField.phoneNumber);
    picker.pickSingleContactAsync().then(function (contact) {
        var contactElement = document.createElement("div");
        var contactData = contact.name + ", ";
        contactData += contact.emails[0].value + ", ";
        contactData += contact.instantMessages[0].value + ", ";
        contactData += contact.locations[0].value + ", ";
        contactData += contact.phoneNumbers[0].value;
        contactElement.innerText = contactData;
        document.body.appendChild(contactElement);
    });
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Namespace

Windows.ApplicationModel.Contacts
Windows::ApplicationModel::Contacts [C++]

Metadata

Windows.winmd

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.