我CalendarEntry谷歌日曆的Java API
我知道http://www.google.com/calendar/feeds/[email protected]/allcalendars/full是所有日曆
的飼料URL的對象,但我怎樣才能從CalendarEntry比如這個供稿網址?
因爲我想發佈一個新的條目在指定的日曆,我需要這個網址。
謝謝!
我CalendarEntry谷歌日曆的Java API
我知道http://www.google.com/calendar/feeds/[email protected]/allcalendars/full是所有日曆
的飼料URL的對象,但我怎樣才能從CalendarEntry比如這個供稿網址?
因爲我想發佈一個新的條目在指定的日曆,我需要這個網址。
謝謝!
我建議你可以指定在你的代碼像下面的代碼片段網址:
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情況下,將通過指定的URL檢索到的每一個日曆(初級,中級,導入的日曆)存儲。
但是,如何獲取特定CalendarEntry實例的提要URL? pccCalendar.getEditLink()。getHref()不起作用。 – 2011-07-03 14:29:47
pccCalendar.getEditLink()。getHref()將無法正常工作,除非您的日曆已被設置爲可公開訪問(我認爲) – user467257 2012-10-27 18:00:55
如果我理解你的問題正確,要做到這一點:
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);
}
}
詛咒谷歌爲他們diabolically混亂日曆的API。
你能發佈你的代碼嗎? – systempuntoout 2010-04-01 15:26:01
你知道嗎? – 2011-10-15 02:01:42