gpt4 book ai didi

windows-10 - 如何从内置日历应用程序中隐藏我的应用程序日历?

转载 作者:行者123 更新时间:2023-12-04 12:18:19 25 4
gpt4 key购买 nike

我的应用需要一个内部日历。我可以像这样创建一个新日历:

var store = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AppCalendarsReadWrite);
var cacheCalendar = await store.CreateAppointmentCalendarAsync("unique name here");

这成功了,我得到了一个新日历。但是这个日历在手机的内置日历应用程序中是可见的。 我不希望此日历可见,因为它用于内部簿记。

所以我尝试像这样隐藏日历:

var store = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AppCalendarsReadWrite);
var cacheCalendar = await store.CreateAppointmentCalendarAsync("unique name here");
cacheCalendar.IsHidden = true; // <---- make calendar hidden
await cacheCalendar.SaveAsync(); // <---- save; error here

调用 SaveAsync时我得到以下异常:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"



为什么我不能从内置的手机日历应用程序中隐藏我的日历?这是一个未记录的限制吗?还有其他方法可以做到这一点吗?

(注意:我在 Windows 10 Mobile 和桌面 Win 10 上对此进行了测试——同样的错误。)

编辑/添加 :自从安东尼发现了 IsHidden属性在 MSDN 中被记录为只读 这里是来自 Visual Studio 的屏幕截图,显示了公共(public) setter (这使得它可以编译、运行并且看似合法调用):

IsHidden property has setter

(该应用程序针对 Win 10 Build 10586 - 也许它是新的,但未完成?)

最佳答案

老实说,我很惊讶这甚至可以编译。

According to the MSDN documentation对于 AppointmentCalandar

IsHidden - Read-only - Gets whether the AppointmentCalendar is hidden in the device's built-in calendar UI



这是 read only property and can't be set .

至于您的实际问题,在仔细查看文档后,这似乎是 API 中的疏忽。我会在 MSDN 论坛上提出这个问题。

关于windows-10 - 如何从内置日历应用程序中隐藏我的应用程序日历?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38425274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com