3

I have an object of CalendarEntry

I know that http://www.google.com/calendar/feeds/[email protected]/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!

1
  • did you figure this out? Commented Oct 15, 2011 at 2:01

2 Answers 2

1

I suggest you to specify that URL in your code like the following snippet:

CalendarService myService = new CalendarService("CalendarService");
myService.setUserCredentials("[email protected]", "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.

Sign up to request clarification or add additional context in comments.

2 Comments

But how do I get the feed URL for the particular CalendarEntry instance? pccCalendar.getEditLink().getHref() doesn't work.
pccCalendar.getEditLink().getHref() will not work unless your calendar has been set as being publicly accessible (I think)
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.