Answering my own Question:
CalendarService service; //create and authenticate this
/*Get a calendar from the user.*/
URL feedUrl = new
URL("http://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarFeed resultFeed = service.getFeed(feedUrl, CalendarFeed.class);
CalendarEntry calendar = resultFeed.getEntries().get(0);
/*Get the calendar ID*/
String editLink = calendar.getId(); //For some reason, getId() returns the
edit link and not the actual calendar id
String id = editLink.substring(editLink.lastIndexOf('/')+1); //Parse the
actual calendar id from this
/*Construct the feed URL to the selected calendar*/
URL postURL = new URL("http://www.google.com/calendar/feeds/" + id +
"/private/full");
/*Create some event you want to add.*/
CalendarEventEntry event = new CalendarEventEntry();
event.setTitle(new PlainTextConstruct("Some Event");
/*Insert the event into the calendar.*/
service.insert(postURL, event);
--
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/calendar/community/forum.html