ContactField
ContactField
ContactField
ContactField
Class
Definition
Describes a piece of contact data.
public : sealed class ContactField : IContactFieldpublic sealed class ContactField : IContactFieldPublic NotInheritable Class ContactField Implements IContactField// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
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.
Constructors
ContactField(String, String, ContactFieldType, ContactFieldCategory) 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(PlatForm::String name, PlatForm::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)// You can use this method in JavaScript.
- name
- PlatForm::String String String String
The name of the field.
- value
- PlatForm::String String String String
The value the field contains.
The type of field.
The category the field belongs to.
ContactField(String, ContactFieldType) 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(PlatForm::String value, ContactFieldType type)public ContactField(String value, ContactFieldType type)Public Sub New(value As String, type As ContactFieldType)// You can use this method in JavaScript.
- value
- PlatForm::String String String String
The value that the field contains.
The type of contact data.
ContactField(String, ContactFieldType, ContactFieldCategory) 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(PlatForm::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)// You can use this method in JavaScript.
- value
- PlatForm::String String String String
The value for the contact field.
The type of contact data.
The category that the contact belongs to.
Properties
Category 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// You can use this property in JavaScript.
The category for the contact data.
Remarks
To see what types of categories you can assign to a ContactField, see ContactFieldCategory.
Name 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// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The name of the field.
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 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// You can use this property in JavaScript.
The type of data.
Remarks
To see what types you can assign to a ContactField, see ContactFieldType.
Value 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// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The value of the contact data.