Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ContactPicker class

Applies to Windows and Windows Phone

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

Syntax


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

Attributes

[Version(0x06020000)]

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
PickContactAsync Launches the Contact Picker to select a single contact.
PickContactsAsync Launches the Contact Picker for selecting multiple contacts.
PickMultipleContactsAsync PickMultipleContactsAsync may be altered or unavailable for releases after Windows 8.1. Instead, use PickContactsAsync. Launches the Contact Picker for selecting multiple contacts.
PickSingleContactAsync PickSingleContactAsync may be altered or unavailable for releases after Windows 8.1. Instead, use PickContactAsync. 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-onlyDesiredFields may be altered or unavailable for releases after Windows 8.1. Instead, use DesiredFieldsWithContactFieldType. Sets the contact fields your app is interested in.

DesiredFieldsWithContactFieldType

Read-onlyGets the ways to connect with a contact.

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 one 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.

Note  Apps that were compiled for Windows 8 but running on Windows 8.1 may encounter runtime errors without compile-time errors.

For info about how to select contacts, see Quickstart: Selecting user contacts (XAML) and Quickstart: Selecting user contacts (HTML).

Examples

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



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 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

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

Contact Picker app sample

 

 

Show:
© 2014 Microsoft