KnownContactField class

KnownContactField class

[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


public ref class KnownContactField abstract sealed 

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

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

Read-only

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

Read-only

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

Read-only

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.

 

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 (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

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

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

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

Attributes

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

See also

Object

 

 

Show:
© 2016 Microsoft