0
我试图在每24小时后将联系人同步到服务器。所以为此我使用了后台代理。 当我尝试呼叫联系人时,它没有得到手机的联系人。 我的代码是在这里...如何在后台获取手机联系人代理WP7
protected override void OnInvoke(ScheduledTask task)
{
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");
#if DEBUG_AGENT
ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(10));
#endif
}
void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
var a = e.Results;
// e.Results.Count();
NotifyComplete();
}
任何人可以让我知道什么是问题或提出一个更好的办法....
您是否收到空列表或错误? – crea7or
没有字段称为计数或e.result中的任何内容。但数据在非公开成员,但我不知道如何访问非公开数据的结果 –