ContactPicker.PickSingleContactAsync | pickSingleContactAsync method

Applies to Windows and Windows Phone

[PickSingleContactAsync may be altered or unavailable for releases after Windows 8.1. Instead, use PickContactAsync. ]

Launches the Contact Picker for selecting a single contact.

Note  In your Windows 8.1 and later apps that run against the Windows 8.1 manifest (Windows 6.3), don't use PickSingleContactAsync; instead, use PickContactAsync. In your Windows 8 apps that run against the Windows 8 manifest (Windows 6.2), you can continue to use PickSingleContactAsync.

Syntax


public:
IAsyncOperation<ContactInformation>^ PickSingleContactAsync()

Parameters

This method has no parameters.

Return value

Type: IAsyncOperation<ContactInformation>

The operation that launches the Contact Picker.

Remarks

To pick multiple contacts at once, use PickMultipleContactsAsync.

Use the SelectionMode property to control whether your app receives all of a contact's information, or just specific fields.

Examples

This example demonstrates how to use the PickSingleContactAsync method.



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

Minimum supported server

Windows Server 2012

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
PickContactAsync

 

 

Show:
© 2014 Microsoft