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.
| Constructor | Description |
|---|---|
| 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.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the category for the contact data. | |
| Read-only | Gets the name of the field. | |
| Read-only | Gets the contact field type for the data. | |
| Read-only | 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] |
|
Namespace |
|
|
Metadata |
|
Build date: 12/4/2012