KnownContactField KnownContactField KnownContactField KnownContactField KnownContactField Class

Definition

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

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

public : static class KnownContactField
static struct winrt::Windows::ApplicationModel::Contacts::KnownContactField
public static class KnownContactField
Public Static Class KnownContactField
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

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

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.

Properties

Email Email Email Email Email

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

Contains the name of the field used for email addresses.

InstantMessage InstantMessage InstantMessage InstantMessage InstantMessage

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

Contains the name of the field used for instant messaging accounts.

Location Location Location Location Location

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

Contains the name of the field used for the contact's location.

PhoneNumber PhoneNumber PhoneNumber PhoneNumber PhoneNumber

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

Contains the name of the field used for phone numbers.

Methods

ConvertNameToType(String) ConvertNameToType(String) ConvertNameToType(String) ConvertNameToType(String) ConvertNameToType(String)

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

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

ConvertTypeToName(ContactFieldType) ConvertTypeToName(ContactFieldType) ConvertTypeToName(ContactFieldType) ConvertTypeToName(ContactFieldType) ConvertTypeToName(ContactFieldType)

Note

KnownContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactConnectedServiceAccount, or ContactEmail.

Converts the type of a field to its corresponding string name.