伙计们的问题有依据,没有代码可以回答这个问题。在下面找到我用来回答这个问题的代码。我稍微修改了你的代码
import com.google.gdata.client.*;
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.*;
import com.google.gdata.data.acl.*;
import com.google.gdata.data.calendar.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.net.*;
import java.io.*;
import java.util.List;
public class GetGoogleCalendarEventByID {
public static void main(String[] args) {
System.out.println("Before Creating CalendarService.");
CalendarService myService = new CalendarService("exampleCo-exampleApp-1.0");
System.out.println("After Creating CalendarService.");
try
{
System.out.println("Going to setUserCredentials.");
myService.setUserCredentials("email@gmail.com", "password");
URL feedUrl =
new URL("https://www.google.com/calendar/feeds/email@gmail.com/private/full");
CalendarEventFeed myFeed = myService.getFeed(feedUrl, CalendarEventFeed.class);
List <CalendarEventEntry> entries = myFeed.getEntries();
for (CalendarEventEntry e : entries){
if (e.getId().equalsIgnoreCase("http://www.google.com/calendar/feeds/email%40gmail.com/events/EventIDLastPart")){
System.out.println("Got the CalendarEventEntry: " + e.getId());
System.out.println("CalendarEventEntry has text: " + e.getPlainTextContent());
}
}
System.out.println("Finished getting Event.");
}
catch(Exception e)
{
System.out.println("Error : " + e.toString());
}
}
}
注意:feedUrl - 这是您在日历设置下找到的日历 URL
事件 ID 的格式为http://www.google.com/calendar/feeds/email%40gmail.com/events/EventIDLastPart
例如
http://www.google.com/calendar/feeds/email%40gmail.com/events/ghytrueueyryrgfuur
希望能帮助到你
恩戈尼丹