ContactField
ContactField
ContactField
ContactField
ContactField
Class
Definition
Describes a piece of contact data.
public : sealed class ContactField : IContactField
struct winrt::Windows::ApplicationModel::Contacts::ContactField : IContactField
public sealed class ContactField : IContactField
Public NotInheritable Class ContactField Implements IContactField
var contactField = new contactField(name, value, type, category);
- Attributes
Device family |
Windows 10 (introduced v10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Capabilities |
contactsSystem
|
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);
}
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.