Integrating contact list for windows 7 phone into app

前端 未结 4 1334
闹比i
闹比i 2021-01-06 23:45

How do I grab the contact list of a windows 7 phone for use inside a win7 phone app?

4条回答
  •  礼貌的吻别
    2021-01-07 00:04

    It's doable in Windows Phone OS 7.1

    Here's the MSDN article on How To Access Contact List Data For Windows Phone

    And here's a code snippet from the article:

    using Microsoft.Phone.UserData;
    
    private void ButtonContacts_Click(object sender, RoutedEventArgs e)
    {
        Contacts cons = new Contacts();
    
        //Identify the method that runs after the asynchronous search completes.
        cons.SearchCompleted += new EventHandler(Contacts_SearchCompleted);
    
        //Start the asynchronous search.
        cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");
    }
    
    void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
    {
        //Do something with the results.
        MessageBox.Show(e.Results.Count().ToString());
    }
    

提交回复
热议问题