WP8自定义联系人存储

时间:2012-11-06 08:35:10

标签: windows-phone-8

我尝试在WP8上创建自定义联系人存储区。我的代码(来自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");

    }

当我点击按钮时,会发生System.UnauthorizedAccessException:访问被拒绝。

我不明白,会发生什么?

1 个答案:

答案 0 :(得分:4)

尝试将 ID_CAP_CONTACTS 功能添加到项目的WMAppManifest.xml文件中。

UnauthorizedAccessException是一种常见的异常类型,当清单中缺少某个功能时会抛出该异常类型。我们只能想知道为什么MS家伙忘记在MSDN文档中添加如此重要的提示。

相关问题