I tried to create custom contact store at WP8. My code (from msdn):
async public void AddContact(string remoteId, string givenName, string familyName, string email, string codeName)
{
ContactStore store = await ContactStore.CreateOrOpenAsync();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
AddContact("0", "Sample", "Sample", "sample@tut.by", "32");
}
When I click on button it occurs System.UnauthorizedAccessException: Access is denied. .
I don’t understand, what happens?
Try add ID_CAP_CONTACTS capability into WMAppManifest.xml file in your project.
UnauthorizedAccessException is a common exception type which is thrown when a certain capability is missing from manifest. We can only wonder why MS guys forgot to add such an important tip into MSDN docs.