2012-10-23 44 views

回答

2

出於安全原因,您無法直接查詢它們。您可以使用聯繫人選擇器來允許用戶選擇單個或多個聯繫人。

您可以實例化選取器,然後允許用戶選擇一個或多個聯繫人。例如:

ContactPicker cp = new ContactPicker(); 
var contacts = await cp.PickMultipleContactsAsync(); 
if (contacts != null && contacts.Count > 0) 
{ 
    MessageDialog md = new MessageDialog(contacts[0].Name); 
    md.ShowAsync(); 
} 
1

這裏是接觸裝載機多個聯繫人的例子中,可以從here

var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker(); 
contactPicker.CommitButtonText = "Select"; 
contacts = await contactPicker.PickMultipleContactsAsync(); 
1

變種contactPicker =新Windows.ApplicationModel.Contacts.ContactPicker得到樣品應用(); contactPicker.CommitButtonText =「Select」;

 contactPicker.SelectionMode = Windows.ApplicationModel.Contacts.ContactSelectionMode.Fields; 
     contactPicker.DesiredFields.Add(Windows.ApplicationModel.Contacts.KnownContactField.Email); 
     ContactInformation contact = await contactPicker.PickSingleContactAsync(); 
     if (contact != null) 
     { 
      contactName.Visibility = Visibility.Visible; 
      contactName.Text = contact.Name; 
      EmailValue.Visibility = Visibility.Visible; 
      EmailValue.Text = contact.Emails[0].Value.ToString(); 
     } 
相關問題