ContactField class

Applies to Windows and Windows Phone

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

Describes a piece of contact data.

Syntax


var contactField = new Windows.ApplicationModel.Contacts.ContactField(string, contactFieldType);
var contactField = new Windows.ApplicationModel.Contacts.ContactField(string, contactFieldType, contactFieldCategory);
var contactField = new Windows.ApplicationModel.Contacts.ContactField(string, string, contactFieldType, contactFieldCategory);

Attributes

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

Members

The ContactField class has these types of members:

Constructors

The ContactField class has these constructors.

ConstructorDescription
ContactField(String,ContactFieldType) IContactFieldFactory may be altered or unavailable for releases after Windows 8.1. Instead, use ContactPhone or ContactEmail. Creates a new ContactField object.
ContactField(String,ContactFieldType,ContactFieldCategory) IContactFieldFactory may be altered or unavailable for releases after Windows 8.1. Instead, use ContactPhone or ContactEmail. Creates a new ContactField object.
ContactField(String,String,ContactFieldType,ContactFieldCategory) IContactFieldFactory may be altered or unavailable for releases after Windows 8.1. Instead, use ContactPhone or ContactEmail. Creates a new ContactField object.

 

Properties

The ContactField class has these properties.

PropertyAccess typeDescription

Category

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

Name

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

Type

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

Value

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

 

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


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

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

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft