将 GData.Extensions.Reminder 添加到提醒时出现 NullreferenceException
我正在一个全新的条目上使用
Reminder fifteenMinReminder = new Reminder();
fifteenMinReminder.Minutes = 15;
fifteenMinReminder.Method = Reminder.ReminderMethod.email;
entry.Reminders.Add(fifteenMinReminder);
(其中 Reminder 和 Reminders 都没什么),但我无法使用上面的代码(直接取自 Google 文档)添加提醒,也无法直接将 entry.Reminder 设置为 FifthMinReminder。
我做错了什么?我在条目中添加“时间和地点”没有遇到任何问题,但“提醒”不想遵循相同的模式。
有什么想法吗?
I'm using
Reminder fifteenMinReminder = new Reminder();
fifteenMinReminder.Minutes = 15;
fifteenMinReminder.Method = Reminder.ReminderMethod.email;
entry.Reminders.Add(fifteenMinReminder);
on a brand new entry (where Reminder and Reminders are Nothing), but I cannot add a reminder using the above code (taken straight from the Google Docs), or set the entry.Reminder to fifteenMinReminder directly either.
What am I doing wrong? I've had no trouble .adding When and Where's to the entry, but the Reminder doesn't want to follow the same pattern.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在将 PHP 文档与 .NET 文档进行比较后,我终于发现 Google .NET API 文档是错误的。您需要将提醒添加到 EventEntry.Times 属性:
不幸的是,这仅适用于单个事件,因为重复事件没有 Times 属性(您可以设置一个,但它没有任何效果) - 这给我带来了我的下一个 stackoverflow 问题...
After comparing the PHP docs with the .NET docs, I finally found out that the Google .NET API docs are wrong. You need to add the Reminder to the EventEntry.Times property:
Unfortunately, this only works for single events because recurring events do not have a Times property (well you can set one, but it doesn't have any effect) - which brings me to my next stackoverflow question...