I've tried to get contact info in Windows Phone 8.1 SL app by following Quickstart: Selecting user contacts
In my function,
private async void PickAContactButton_Click(object sender, RoutedEventArgs e)
{
var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
contactPicker.desiredFieldsWithContactFieldType.add(Windows.ApplicationModel.Contacts.ContactFieldType.email);
Contact contact = await contactPicker.PickContactAsync(); // this throws System.NotImplementedException
// Additional information: The method or operation is not implemented.
if (contact != null)
{ ... }
}
Exact same function works in Windows Phone 8.1 RT. ContactPicker
class is supported in both WP 8.1 RT and WP 8.1 SL according to this reference.
Any idea what is going on ?
I had this behaviour today in my Universal Store App for Win 8.1, so may be this helps you out. I had different exceptions though (FileNotFoundException and just plain System.Exception), so I'm not really certain this is the same issue.
As far as my experiments go, this is what is currently needed to make ContactPicker work:
This is what I ended up doing:
// using Windows.ApplicationModel.Core;
// in an async method:
Contact user = null;
AutoResetEvent resetEvent = new AutoResetEvent(false);
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
CoreDispatcherPriority.Normal,
(async ()=>{
ContactPicker contactPicker = new ContactPicker();
contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);
user = await contactPicker.PickContactAsync();
resetEvent.Set();
}
);
resetEvent.WaitOne();
if (user != null) {
// do smth
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With