Being a Contact Picker Source

Initiating the contact picker user interface looks just like initiating the file picker on a PC. You can use a ContactPicker class from the Windows.ApplicationModel.Contacts namespace as follows:

// Get a contact from the user ContactPicker picker = new ContactPicker(); Contact contact = await picker.PickContactAsync();

The resultant picker is shown in Figure 21.10. This enables the user to pick a contact to provide to your app. You don’t get to access the entire contacts database yourself. (There is a capability for such a thing, but it’s phone-specific.) You can, however, ask the user to pick several contacts by calling PickContactsAsync instead.

FIGURE 21.10 The Contact Picker ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.