从 Windows 10 个应用检索通话记录 - 访问被拒绝错误
Retrieving calls history from Windows 10 app - Access denied error
我正在尝试使用最新的 API 收集 Windows Mobile 10 通话记录。我已经为我的应用程序启用了所有可能的功能,但在 运行 此代码时我仍然收到 "Access Denied" 错误:
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
知道哪里出了问题吗?
为了使上面的代码正常工作并查看phone通话记录,需要添加以下内容:
1) 重命名空间
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
2) 能力受限"phoneCallHistory"
<rescap:Capability Name="phoneCallHistory"/>
3) 将 PhoneCallHistoryAccessType 更改为 AllEntriesLimitedReadAndWrite。
var operation = PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesLimitedReadWrite);
感谢@RaymondChen 给我正确的功能名称。
我正在尝试使用最新的 API 收集 Windows Mobile 10 通话记录。我已经为我的应用程序启用了所有可能的功能,但在 运行 此代码时我仍然收到 "Access Denied" 错误:
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
知道哪里出了问题吗?
为了使上面的代码正常工作并查看phone通话记录,需要添加以下内容:
1) 重命名空间
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
2) 能力受限"phoneCallHistory"
<rescap:Capability Name="phoneCallHistory"/>
3) 将 PhoneCallHistoryAccessType 更改为 AllEntriesLimitedReadAndWrite。
var operation = PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesLimitedReadWrite);
感谢@RaymondChen 给我正确的功能名称。