1

我需要从用户的“人脉”应用程序中提取姓名和电子邮件地址,以便我有一个他们所有联系人的列表,以便在弹出/弹出窗口中显示给他们。这该怎么做?

4

3 回答 3

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();
}
于 2012-10-23T01:39:14.070 回答
1

这是多个联系人的联系人选择器示例,您可以从此处获取示例应用程序

var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
contactPicker.CommitButtonText = "Select";
contacts = await contactPicker.PickMultipleContactsAsync();
于 2012-10-23T01:41:43.867 回答
1

var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker(); contactPicker.CommitButtonText = "选择";

        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();
        }
于 2013-01-07T07:18:59.320 回答