ContactField class

1 out of 2 rated this helpful - Rate this topic

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

ActivatableAttribute(Windows.ApplicationModel.Contacts.IContactFieldFactory, NTDDI_WIN8)
MarshalingBehaviorAttribute(Agile)
VersionAttribute(NTDDI_WIN8)

Members

The ContactField class has these types of members:

Constructors

The ContactField class has these constructors.

ConstructorDescription
ContactField(String, ContactFieldType) Creates a new ContactField object.
ContactField(String, ContactFieldType, ContactFieldCategory) Creates a new ContactField object.
ContactField(String, String, ContactFieldType, ContactFieldCategory) Creates a new ContactField object.

 

Methods

The ContactField class inherits methods from the Object class (C#/VB/C++).

Properties

The ContactField class has these properties.

PropertyAccess typeDescription

Category

Read-onlyGets the category for the contact data.

Name

Read-onlyGets the name of the field.

Type

Read-onlyGets the contact field type for the data.

Value

Read-onlyGets 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]

Namespace

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

Metadata

Windows.winmd

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.