Contact​Field Contact​Field Contact​Field Class

Definition

Describes a piece of contact data.

public sealed class ContactField : IContactFieldpublic sealed class ContactField : IContactFieldPublic NotInheritable Class ContactField Implements IContactField
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Each time you create a Contact object, you get a Fields property. This property contains the data that relates to the contact. To populate a Contact object with data, you append the Fields object with one or more instances of ContactField.

At a minimum, a ContactField object must contain a string value and a ContactFieldType, which specifies whether the data is a phone number, email address, physical address, or something else. You can also add a ContactFieldCategory to differentiate between home, work, personal, or other data. You can also use a ContactField object to add custom fields to a Contact.

Examples

This example demonstrates how to create a ContactField object and add it to a contact.

function contactFieldTest() {
    var contact = new Windows.ApplicationModel.Contacts.Contact();
    var value = "test@fabrikam.com";
    var type = Windows.ApplicationModel.Contacts.ContactFieldType.email;
    var category = Windows.ApplicationModel.Contacts.ContactFieldCategory.work;
    var contactField = new Windows.ApplicationModel.Contacts.ContactField(value, type, category);
    contact.fields.append(contactField);
}

Constructors

ContactField(String, String, ContactFieldType, ContactFieldCategory) ContactField(String, String, ContactFieldType, ContactFieldCategory) ContactField(String, String, ContactFieldType, ContactFieldCategory)

Note

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

Creates a new ContactField object.

public ContactField(String name, String value, ContactFieldType type, ContactFieldCategory category)public ContactField(String name, String value, ContactFieldType type, ContactFieldCategory category)Public Sub New(name As String, value As String, type As ContactFieldType, category As ContactFieldCategory)
Parameters
name
System.String System.String System.String

The name of the field.

value
System.String System.String System.String

The value the field contains.

category
ContactFieldCategory ContactFieldCategory ContactFieldCategory

The category the field belongs to.

Attributes

ContactField(String, ContactFieldType) ContactField(String, ContactFieldType) ContactField(String, ContactFieldType)

Note

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

Creates a new ContactField object.

public ContactField(String value, ContactFieldType type)public ContactField(String value, ContactFieldType type)Public Sub New(value As String, type As ContactFieldType)
Parameters
value
System.String System.String System.String

The value that the field contains.

type
ContactFieldType ContactFieldType ContactFieldType

The type of contact data.

Attributes

ContactField(String, ContactFieldType, ContactFieldCategory) ContactField(String, ContactFieldType, ContactFieldCategory) ContactField(String, ContactFieldType, ContactFieldCategory)

Note

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

Creates a new ContactField object.

public ContactField(String value, ContactFieldType type, ContactFieldCategory category)public ContactField(String value, ContactFieldType type, ContactFieldCategory category)Public Sub New(value As String, type As ContactFieldType, category As ContactFieldCategory)
Parameters
value
System.String System.String System.String

The value for the contact field.

type
ContactFieldType ContactFieldType ContactFieldType

The type of contact data.

category
ContactFieldCategory ContactFieldCategory ContactFieldCategory

The category that the contact belongs to.

Attributes

Properties

Category Category Category

Note

ContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactSignificantOther, Contact, ContactEmail, ContactConnectedServiceAccount, ContactWebsite, ContactJobInfo, or ContactDate.

Gets the category for the contact data.

public ContactFieldCategory Category { get; }public ContactFieldCategory Category { get; }Public ReadOnly Property Category As ContactFieldCategory
Value
ContactFieldCategory ContactFieldCategory ContactFieldCategory

The category for the contact data.

Attributes

Remarks

To see what types of categories you can assign to a ContactField, see ContactFieldCategory.

Name Name Name

Note

ContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactSignificantOther, Contact, ContactEmail, ContactConnectedServiceAccount, ContactWebsite, ContactJobInfo, or ContactDate.

Gets the name of the field.

public PlatForm::String Name { get; }public string Name { get; }Public ReadOnly Property Name As string
Value
string string string

The name of the field.

Attributes

Remarks

If the ContactField was created using a ContactFieldType enumeration, then the Name property is the same as the ContactFieldType value (such as Email or PhoneNumber). If the ContactField contains a custom field, the Name property is the name of the field.

Type Type Type

Note

ContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactSignificantOther, Contact, ContactEmail, ContactConnectedServiceAccount, ContactWebsite, ContactJobInfo, or ContactDate.

Gets the contact field type for the data.

public ContactFieldType Type { get; }public ContactFieldType Type { get; }Public ReadOnly Property Type As ContactFieldType
Attributes

Remarks

To see what types you can assign to a ContactField, see ContactFieldType.

Value Value Value

Note

ContactField may be altered or unavailable for releases after Windows 8.1. Instead, use ContactAddress, ContactPhone, ContactSignificantOther, Contact, ContactEmail, ContactConnectedServiceAccount, ContactWebsite, ContactJobInfo, or ContactDate.

Gets the value of the contact data.

public PlatForm::String Value { get; }public string Value { get; }Public ReadOnly Property Value As string
Value
string string string

The value of the contact data.

Attributes