ContactPicker.SelectionMode | selectionMode property

Applies to Windows and Windows Phone

Controls whether the Contact Picker shows contacts as a complete entity or as a collection of fields.

Syntax


Public Property SelectionMode As ContactSelectionMode

Property value

Type: ContactSelectionMode

The mode for the Contact Picker user interface. You can set this to Contacts or Fields.

Remarks

A contact can contain a lot of information. If you want all of this information, set the SelectionMode property to return the entire contact. If you are only interested in specific fields, set this property to return only a selection of fields, then use the DesiredFields property to specify which fields you want.

Use the ContactSelectionMode enumeration to set the value of this property.

Examples

This example demonstrates how to use the SelectionMode property.



function selectContact() {
    // Create the picker
    var picker = new Windows.ApplicationModel.Contacts.ContactPicker();
    picker.commitButtonText = "Select";
    picker.selectionMode = Windows.ApplicationModel.Contacts.ContactSelectionMode.fields;
    picker.desiredFieldsWithContactFieldType.append(Windows.ApplicationModel.Contacts.ContactFieldType.email);    

    // Open the picker for the user to select a contact
    picker.pickContactAsync().done(function (contact) {
        var contactElement = document.createElement("div");
        contactElement.innerText = contact.name + " " + contact.emails[0].address;
        document.body.appendChild(contactElement);
    });
}



Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

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

See also

ContactPicker

 

 

Show:
© 2014 Microsoft