KnownContactField class

Applies to Windows only

[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.

Syntax


var knownContactField = Windows.ApplicationModel.Contacts.KnownContactField;

Attributes

[Deprecated()]
[MarshalingBehavior(Agile)]
[Version(0x06020000)]

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 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 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.

 

Properties

The KnownContactField class has these properties.

PropertyAccess typeDescription

Email

Read-onlyKnownContactField 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

Read-onlyKnownContactField 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

Read-onlyKnownContactField 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

Read-onlyKnownContactField 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.

 

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]

Minimum supported phone

None supported

Namespace

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

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft