我正在尝试使用最新的 API 收集 Windows Mobile 10 调用历史记录。我已为我的应用程序启用了所有可能的功能,但在运行此代码时仍然出现“访问被拒绝”错误:
var operation = PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AppEntriesReadWrite);
operation.Completed = (o, ev) =>
{
PhoneCallHistoryStore store = o.GetResults();
PhoneCallHistoryEntryReader reader = store.GetEntryReader();
var operation2 = reader.ReadBatchAsync();
operation2.Completed = (o2, ev2) =>
{
IReadOnlyList<PhoneCallHistoryEntry> callsList = o2.GetResults();
foreach (PhoneCallHistoryEntry entry in callsList)
{
// process calls here
}
};
};
我在执行第 4 行时收到以下错误消息:
An exception of type 'System.UnauthorizedAccessException' occurred in App1.exe but was not handled in user code
Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
我在 Visual Studio 2015 的移动模拟器上运行此代码。这是我用于该代码的代码: https ://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.aspx
知道有什么问题吗?