Here is a small snippet to get the contact details with the AddressChooser task and Contact class (new for Windows Phone 8) for an Windows Phone 8 app:
public MainPage()
{
InitializeComponent();
addressTask = new AddressChooserTask();
addressTask.Completed += addressTask_Completed;
}
private void btnContacts_Click(object sender, RoutedEventArgs e)
{
addressTask.Show();
}
void addressTask_Completed(object sender, AddressResult e)
{
if (e.TaskResult == TaskResult.OK)
{
var contacts = new Contacts();
contacts.SearchCompleted += contacts_SearchCompleted;
contacts.SearchAsync(e.DisplayName, FilterKind.DisplayName, null);
}
}
private void contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
if (e.Results != null && e.Results.Any())
{
var firstOrDefault = e.Results.FirstOrDefault();
if (firstOrDefault != null)
{
var contactPhoneNumber = firstOrDefault.PhoneNumbers.FirstOrDefault(tel => tel.Kind==PhoneNumberKind.Mobile);
if (contactPhoneNumber != null)
{
TextTelephoneNumber.Text = contactPhoneNumber.PhoneNumber;
SmsNumber.Text = contactPhoneNumber.PhoneNumber;
}
var contactEmail = firstOrDefault.EmailAddresses.FirstOrDefault();
if (contactEmail != null)
{
MailAddress.Text = contactEmail.EmailAddress;
}
}
}
}