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.
| Method | Description |
|---|---|
| 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.
| Property | Access type | Description |
|---|---|---|
| Read-only | Contains the name of the field used for email addresses. | |
| Read-only | Contains the name of the field used for instant messaging accounts. | |
| Read-only | Contains the name of the field used for the contact's location. | |
| Read-only | 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] |
|
Namespace |
|
|
Metadata |
|
Build date: 12/4/2012