2012-09-04 116 views
0

我在手機中有一些普通聯繫人,並且我還在手機中配置了facebook,google和hotmail。在我的本地人中心,我可以看到我的手機聯繫人以及我的Facebook聯繫人和其他人。我想獲取所有具有電話號碼的聯繫人信息。我如何從WP7聯繫人API中獲得。獲取Facebook聯繫人和其他類型的聯繫人信息來自WP7聯繫人數據

 var Contacts = new Microsoft.Phone.UserData.Contacts(); 

     // hook up an event handler to retrieve the contacts after we've searched for them on the WP7 
     Contacts.SearchCompleted += ContactsSearchCompleted; 

     //Start the search asynchronously. 
     Contacts.SearchAsync(String.Empty, FilterKind.None, null); 

回答

0

以這種方式搜索並不是特別適合於搜索具有值的聯繫人,而是用於搜索特定值的聯繫人。

您可以對單個字符進行多重搜索(使用FilterKind.PhoneNumber選項),然後合併它們。

獲得所有結果(比如你在代碼中)然後直接查詢它們可能會容易得多。

喜歡的東西:

foreach (var contact in e.Results) 
{ 
    if (contact.PhoneNumbers.Count() > 0) 
    { 
     // This contact has at least 1 phone number. 
     // Do something approrpiate with it 
    } 
} 
相關問題