Question

When I try to access the contacts list in Windows Phone 7 using Contacts.SearchAsync, I get back a list of all the contacts on my phone.

However, iterating through the PhoneNumber property (list of ContactPhoneNumber's), it does not contain any phone numbers from facebook...

i.e., if the contact has 2 numbers in the "People" hub, one that was manually added to the phone or through Live, and another that got integrated directly from facebook, the facebook phone number doesn't show up in the PhoneNumber list for the contact.

Any thoughts on how to retreive the facebook contact phone number as well?

Here's my code:

public MainPage()
{            
     Contacts myContacts = new Contacts();
     myContacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(myContacts_SearchCompleted);
     myContacts.SearchAsync(String.Empty, FilterKind.None, "");
}

void myContacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
     List<Contact> myContacts = e.Results.ToList<Contact>();
     int numbers = myContacts[1].PhoneNumbers.Count(); //Returns 0 if the contact was from facebook, returns 1 if the contact had a number from Live.
}

}

Was it helpful?

Solution

I'm pretty sure this is restricted on purpose by the operating system and you would need to request it as a feature on their user voice site. You can't normally access friends phone numbers from the Facebook API (even if you created your own Facebook app) so I'm guessing Facebook made Microsoft restrict access to those values from third party apps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top