Here we are using ContactPicker to get the information of the contact.

Step 1: Open a blank app and add a Button and a TextBlock either from the toolbox or by copying the following XAML code into your grid.

  1. <StackPanel Margin="20,20,0,0">
  2. <TextBlock Text="Contact Picker" FontSize="20"></TextBlock>
  3. <StackPanel Margin="10" >
  4. <Button Name="contactPicker" Content="Pick a contact" Height="40" Width="130" Click="contactPicker_Click" ></Button>
  5. <TextBlock Name="selectedContact" Margin="10,20,0,0" Height="50" FontSize="20"></TextBlock>
  6. </StackPanel>
  7. </StackPanel>

Step 2: Add the following namespaces to your project which is needed in further C# code.

  1. using System.Text;
  2. using Windows.ApplicationModel.Contacts;

Step 3: Copy and paste the following code to the cs page which will be called on button click event and will open the contact list.

  1. private async void contactPicker_Click(object sender, RoutedEventArgs e)
  2. {
  3. var contactPicker = new ContactPicker();
  4. contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);
  5. Contact contact = await contactPicker.PickContactAsync();
  6. var result = new StringBuilder();
  7. result.AppendFormat("Name: {0}", contact.DisplayName);
  8. result.AppendLine();
  9. foreach (ContactPhone phone in contact.Phones)
  10. {
  11. result.AppendFormat("Phone: {0}", phone.Number);
  12. result.AppendLine();
  13. }
  14. selectedContact.Text = result.ToString();
  15. }

Step 4: Run your application and test yourself.