I have an object of CalendarEntry
I know that http://www.google.com/calendar/feeds/example@gmail.com/allcalendars/full is the feed url of all calendars
but how I can get this feed url from CalendarEntry instance?
Because I wanna post a new entry in a specified calendar and I need this url.
Thanks!
I suggest you to specify that URL in your code like the following snippet:
CalendarService myService = new CalendarService("CalendarService");
myService.setUserCredentials("example@gmail.com", "yourPassword");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
System.out.println("Your calendars:");
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
System.out.println("\t" + entry.getTitle().getPlainText());
}
CalendarEntry instances will store every calendars (primary, secondary,imported calendars) retrieved by the specified URL.
If I understand your question correctly, you want to do this:
public static URL toCalendarFeedURL(CalendarEntry calendarEntry) {
try {
String cal = "https://www.google.com/calendar/feeds" + calendarEntry.getEditLink().getHref().substring(63) + "/private/full";
return new URL(cal);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
Curse Google for their diabolically confusing calendar APIs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.