帮助访问联系人 [英] Help accessing contacts

查看:57
本文介绍了帮助访问联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,


正在尝试学习移动编程并且现在非常努力地吸吮它。我需要提取手机上的所有联系人,并允许用户选择(选中)他们想要包含在所选群组中的联系人。 现在宝贝步骤。我只需要先
学习如何查询联系人期间。演练中的示例不运行...我假设因为它们是7.1 ??


有人能告诉我如何简单地拉出WP8上的联系人列表吗?



解决方案


您可以这种方式查询联系人。


//您的联系人对象//

 

联系人cons = new Contacts();

//确定异步搜索完成后运行的方法。
cons.SearchCompleted + = new EventHandler< ContactsSearchEventArgs>(Contacts_SearchCompleted);

//启动异步搜索。
cons.SearchAsync(String.Empty,FilterKind.None,"联系人测试#1");

//您的联系人代表//


 

void Contacts_SearchCompleted( object sender,ContactsSearchEventArgs e)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();

foreach (联系con in e.Results)
{
sb.AppendLine(con.DisplayName);
}

MessageBox.Show(sb.ToString());
}

您可以从此处获取详细信息。

http://msdn.microsoft.com/en-us/library/windowsphone/develop /hh286416%28v=vs.105%29.aspx


All,

Trying to learn mobile programming and im sucking pretty hard at it right now. I need to pull up all contacts on the phone and allow users to select (check) the contacts they'd like to include in the selected group.  Now baby steps. I just need to first learn how to query contacts period. The examples on the walkthrough don't run... im assuming because they are for 7.1 ??

Can anyone show me how to simply pull up the contact list on WP8?

解决方案

Hi,

You can query contacts in this way.

// Your Contacts Object//

Contacts cons = new Contacts(); //Identify the method that runs after the asynchronous search completes. cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted); //Start the asynchronous search. cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");

// Your Contacts Delegate //

void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (Contact con in e.Results) { sb.AppendLine(con.DisplayName); } MessageBox.Show(sb.ToString()); }

You can get detailed information from here.

http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh286416%28v=vs.105%29.aspx


这篇关于帮助访问联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆