English 中文(简体)
B. 如何将所有接触和书写到Windows电话档案 7
原标题:How to get all contacts and write into file for Windows phone 7

The problem I want to solve: Get all the contacts info like name and Mobile phone and write it into file and save in ISO.

  1. How to use SearchAsync if I want to search available contacts in the phone?
  2. How to iterate the return-results and write to file one by one of the contact into a file?

这里,我有:

private void btnSearch_Click(object sender, RoutedEventArgs e)
{    
    Contacts contacts = new Contacts();     
    contacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(contacts_SearchCompleted);   
    contacts.SearchAsync(displayName,FilterKind.DisplayName,null);    
    //search for all contacts   
    contacts.SearchAsync(string.Empty, FilterKind.None, null);
}

<>Update:

  1. 如果电话公司是雇佣公司,则以下代码将产生NllException错误。 为什么?

  2. 如何获得除<条码>外的所有传真号码。

  3. Same question for Email Addresses

利用这一途径在电话中搜寻所有联系人:

contacts.SearchAsync(searchterm, FilterKind.None, null);

void contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
    int intTTL = e.Results.Count();
    if (intTTL != 0)
    {
        MessageBox.Show(intTTL.ToString());
        foreach (var result in e.Results)
        {
            string strTTL;
            string strName = result.DisplayName;
            string MobileNo = result.PhoneNumbers.FirstOrDefault().ToString();
            strTTL = strName + "," + MobileNo;
            MessageBox.Show(strTTL);
        }
    else
    {
        MessageBox.Show("You have not entered any contact info at all.");
    }
}
最佳回答
问题回答

暂无回答




相关问题
System.Json namespace missing from Windows Phone 7

During a Mix10 presentation, the presenter (Charlie Kindel) said that when writing Silverlight based apps for WP7 you get all of Silverlight 3.0 with some of Silverlight 4.0 mixed in. Why then is ...

Will Windows Phone 7 Support Multitasking third party apps

Obviously it s early days, I do not know whether this is information that is in the public domain or not yet, but... I have trawled through some of this site - http://www.windowsphone7series.com/ but ...

Windows Series Phone 7 "Cloud"

I have been reading up on "Cloud computing" on here and still not getting it. Basically I want to develop for the WP7 http://msdn.microsoft.com/en-us/library/ff402531%28v=VS.92%29.aspx#...

Windows Phone 7 Tab Pages (page cycle)

I know.. I know, it s only a few hours old. But how the hell do you get the little page tabbing/cycle (forgot what the official name is) on the top of the page under the app title. MIX Keynotes made ...

Recording audio from the microphone in Windows Phone 7 Series

I m wondering if anyone has any code samples or links to documentation that demonstrate how to capture audio from the device s microphone on the new Windows Phone Series 7. I ve recently downloaded ...

Resources for Windows Phone 7 development [closed]

Windows Phone 7 has been unveiled and MS have announced all details of the development chain at the Mix10 conference. So this could be a good starting point/collection of online resources as they ...

热门标签