I'm trying to allow the user to select a contact from the People app this way:
private async Task<System.Collections.Generic.KeyValuePair<string, string>> SelectAContactForASlot()
{
KeyValuePair<string, string> kvp; // = new KeyValuePair<string, string>();
var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
contactPicker.CommitButtonText = "Select";
var contact = await contactPicker.PickSingleContactAsync();
if (contact != null)
{
kvp = new KeyValuePair<string, string>(contact.Name, contact.Emails[0].ToString());
return kvp;
}
return kvp = new KeyValuePair<string, string>("No Name found", "No email found");
}
The People app does get invoked, but it looks like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ People v
Something went wrong, and this app can't pick contacts right now.
Try selecting the app again.
| Select | | Cancel |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I added a couple of contacts yesterday, so it does contain contacts. Is there something wrong with my code, or how else can I solve this problem?