ContactPicker ContactPicker ContactPicker ContactPicker ContactPicker Class

Definition

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

public : sealed class ContactPicker : IContactPicker, IContactPicker2, IContactPicker3
struct winrt::Windows::ApplicationModel::Contacts::ContactPicker : IContactPicker, IContactPicker2, IContactPicker3
public sealed class ContactPicker : IContactPicker, IContactPicker2, IContactPicker3
Public NotInheritable Class ContactPicker Implements IContactPicker, IContactPicker2, IContactPicker3
var contactPicker = new contactPicker();
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

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);
    });
}

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 Selecting contacts and Quickstart: Selecting user contacts.

Constructors

ContactPicker() ContactPicker() ContactPicker() ContactPicker() ContactPicker()

Creates a new instance of the ContactPicker class.

Properties

CommitButtonText CommitButtonText CommitButtonText CommitButtonText CommitButtonText

Sets the text for the confirmation button in the Contact Picker user interface.

Note

This property is no longer available starting with Windows 10.

DesiredFields DesiredFields DesiredFields DesiredFields DesiredFields

Sets the contact fields your app is interested in.

Note

This property is no longer available starting with Windows 10.

DesiredFieldsWithContactFieldType DesiredFieldsWithContactFieldType DesiredFieldsWithContactFieldType DesiredFieldsWithContactFieldType DesiredFieldsWithContactFieldType

Gets the ways to connect with a contact.

SelectionMode SelectionMode SelectionMode SelectionMode SelectionMode

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

Note

This property is no longer available starting with Windows 10.

User User User User User

Gets the User associated with the ContactPicker.

Methods

CreateForUser(User) CreateForUser(User) CreateForUser(User) CreateForUser(User) CreateForUser(User)

Creates a new ContactPicker for a specific User.

IsSupportedAsync() IsSupportedAsync() IsSupportedAsync() IsSupportedAsync() IsSupportedAsync()

Gets a Boolean value indicating if the contact picker is supported on the current platform.

PickContactAsync() PickContactAsync() PickContactAsync() PickContactAsync() PickContactAsync()

Launches the Contact Picker to select a single contact.

PickContactsAsync() PickContactsAsync() PickContactsAsync() PickContactsAsync() PickContactsAsync()

Launches the Contact Picker for selecting multiple contacts.

PickMultipleContactsAsync() PickMultipleContactsAsync() PickMultipleContactsAsync() PickMultipleContactsAsync() PickMultipleContactsAsync()

Launches the Contact Picker for selecting multiple contacts.

Note

This method is no longer available starting with Windows 10.

PickSingleContactAsync() PickSingleContactAsync() PickSingleContactAsync() PickSingleContactAsync() PickSingleContactAsync()

Launches the Contact Picker for selecting a single contact.

Note

This method is no longer available starting with Windows 10.

See Also