【问题标题】:Adding and Retrieving Extended Property using Google Calendar API使用 Google Calendar API 添加和检索扩展属性
【发布时间】:2010-12-16 10:27:52
【问题描述】:
我正在编写一个代码来将我的 Outlook 日历与谷歌日历同步。我可以添加条目,但问题是当我想更新谷歌日历中的项目时,我不知道要更新哪个。
为了解决我正在添加扩展属性
ExtendedProperty property = new ExtendedProperty();
property.Name = reminderAppt.GlobalAppointmentID;
property.Value = "App Id";
entry.ExtensionElements.Add(property);
问题是当ItemChanged 被调用时,我不知道如何检索相同的条目。
【问题讨论】:
标签:
c#
google-calendar-api
【解决方案1】:
这是我在检索扩展属性元素时使用的。
foreach (Google.GData.Client.IExtensionElementFactory property in googleEvent.ExtensionElements)
{
ExtendedProperty customProperty = property as ExtendedProperty;
if (customProperty != null)
genericEvent.EventID = customProperty.Value;
}
【解决方案2】:
老问题,但可能对某些人有帮助:
EventEntry.Insert 方法得到一个返回值,它返回一个对象,其中包含 google calendarItem 的唯一 EventId。
您可以使用该 ID 使您的日历条目与 Outlook 保持同步。