1

I am working on a custom notepad application that supports the Google Calendar API and have been on a dead end for some time now. The problem is that I try (using the standard code) to update / adjust an existing event. But in VB I only manage to get an AtomFeed and that allows everything but changing the Event date / time (as far as I could see / Google). The code:

EventQuery myQuery = new EventQuery(feedUrl);
myQuery.Query = "Tennis";
EventFeed myResultsFeed = myService.Query(myQuery);
if (myResultsFeed.Entries.Count > 0) {
AtomEntry firstMatchEntry = myResultsFeed.Entries0];
String myEntryTitle = firstMatchEntry.Title.Text;

In this code the query returns an EventFeed type that contains the start / end time of a single occuring event easy accessible through the When class. However if I translate that code to VB instead of C# (I created my notes application in VB.NET 2010) the service.Query method only returns an AtomFeed. I can not seem to acces the Event Start / End date from the AtomEntry, nor have I found a way to parse or convert the Atom type to the Event type classes... My current code:

Dim myResultsFeed As AtomFeed = service.Query(myQuery)
Dim firstMatchEntry As AtomEntry

If (myResultsFeed.Entries.Count > 0) Then
firstMatchEntry = myResultsFeed.Entries(0)
firstMatchEntry.Title.Text = updatedNote.Subject

'Would be available in the EventEntry class
'firstMatchEntry.times.add(New [When](gNote.GCalendarDate, endDate))
firstMatchEntry.Update()

I have searched the net extensively. Any responses are very much appreciated!

4

1 回答 1

1

我不确定我是否理解您的问题,但如果您想从 vb.net 更新您的开始和结束时间,您首先必须清除现有时间并添加一个新时间,就好像您会使用创建事件一样。以下是代码。

>

       Dim srvce As New Google.GData.Calendar.CalendarService("gCal")
       Dim query As New FeedQuery
       Dim evntEntry As Google.GData.Calendar.EventEntry

       query.Uri = New Uri(eventSelfURI) 'SELF URI IS THE URI FOR GOOGLE CALENDAR FEED

       srvce.setUserCredentials("<<EMAIL>>", "<<PASSWORD>>")
       Dim calfeed As AtomFeed
       calfeed = srvce.Query(query)


       evntEntry.Title.Text = newTitle
       evntEntry.Content.Content = newContent

       'SETTING UP THE START AND END TIME - FIRST CLEARING EXISTING TIMING AND ADDING NEW
       evntEntry.Times.Clear() 'THIS WILL CLEAR THE EXISTING TIME
       Dim newTime As New [When]()
       newTime.StartTime = newStartDateTime
       newTime.EndTime = newEndDateTime
       evntEntry.Times.Add(newTime)

       evntEntry.Update()

希望这会帮助你。

于 2013-03-04T05:15:00.417 回答