ContactPicker class

2 out of 2 rated this helpful - Rate this topic

Controls how the Contact Picker user interface opens and what information it shows.

Syntax


var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();

Attributes

ActivatableAttribute(NTDDI_WIN8)
VersionAttribute(NTDDI_WIN8)

Members

The ContactPicker class has these types of members:

Constructors

The ContactPicker class has these constructors.

ConstructorDescription
ContactPicker Creates a new instance of the ContactPicker class.

 

Methods

The ContactPicker class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
PickMultipleContactsAsync Launches the Contact Picker for selecting multiple contacts.
PickSingleContactAsync Launches the Contact Picker for selecting a single contact.

 

Properties

The ContactPicker class has these properties.

PropertyAccess typeDescription

CommitButtonText

Read/writeSets the text for the confirmation button in the Contact Picker user interface.

DesiredFields

Read-onlySets the contact fields your app is interested in.

SelectionMode

Read/writeControls whether the Contact Picker shows contacts as a complete entity or as a collection of fields.

 

Remarks

The ContactPicker class enables users to select or more contacts from any app that supports the Contact Picker contract. You can configure the ContactPicker class to accept only a single contact, or multiple contacts. In addition, you can request that the app providing the contact information return the entire set of data for each contact, or just specific fields.

Examples

This example demonstrates using the ContactPicker to get the name and email address of a single contact.


function selectContact() {
    var picker = Windows.ApplicationModel.Contacts.ContactPicker();
    picker.commitButtonText = "Select";
    picker.selectionMode = Windows.ApplicationModel.Contacts.ContactSelectionMode.fields;
    picker.desiredFields.append(Windows.ApplicationModel.Contacts.KnownContactField.email);
    picker.pickSingleContactAsync().then(function (contact) {
        var contactElement = document.createElement("div");
        contactElement.innerText = contact.name + " " + contact.emails[0].value;
        document.body.appendChild(contactElement);
    });
}


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.