0
我想插入事件的主鍵到谷歌日曆,然後在EventQuery調用後檢索它來更新該事件如何從asp應用程序更新Google日曆事件?
我沒有在Evententry類中找到任何屬性來分配主鍵,以及稍後檢索以更新事件。
我想插入事件的主鍵到谷歌日曆,然後在EventQuery調用後檢索它來更新該事件如何從asp應用程序更新Google日曆事件?
我沒有在Evententry類中找到任何屬性來分配主鍵,以及稍後檢索以更新事件。
它可以通過使用ExtendedProperty下面
1.Assign an ID (same as you set in your DB) to each event you add through
ExtendedProperty .
2.When updating/deleting you pass the ID and use Query to fetch it for you
3.If the event is found you can delete/update the specific event
Google.GData.Calendar.EventEntry Entry = new Google.GData.Calendar.EventEntry();
//create the ExtendedProperty and add the EventID in the new event object,
//so it can be deleted/updated later
ExtendedProperty oExtendedProperty = new ExtendedProperty();
oExtendedProperty.Name = "EventID";
oExtendedProperty.Value = GoogleAppointmentObj.EventID;
Entry.ExtensionElements.Add(oExtendedProperty);
string ThisFeedUri = "http://www.google.com/calendar/feeds/" + CalendarID
+ "/private/full";
Uri postUri = new Uri(ThisFeedUri);
//create an event query object and attach the EventID to it in Extraparameters
EventQuery Query = new EventQuery(ThisFeedUri);
Query.ExtraParameters = "extq=[EventID:" + GoogleAppointmentObj.EventID + "]";
Query.Uri = postUri;
//Find the event with the specific ID
EventFeed calFeed = CalService.Query(Query);
//if search contains result then delete
if (calFeed != null && calFeed.Entries.Count > 0)
{
foreach (EventEntry SearchedEntry in calFeed.Entries)
{
SearchedEntry.Delete();
//To update comment the code above and uncomment the code below
//CalService.Update(SearchedEntry);
break;
}
}
else
{
InsertedEntry = CalService.Insert(postUri, Entry);
}
的方法來完成