내가 CalendarEntry 인스턴스에서이 피드 URL을 얻을 수있는 방법 CalendarEntry구글 캘린더 자바 API를
내가 http://www.google.com/calendar/feeds/[email protected]/allcalendars/full 모든 일정
의 피드 URL 것을 알고의 객체를 가지고 있지만?지정된 캘린더에 새 항목을 게시하고 싶기 때문에이 URL이 필요합니다.
감사합니다.
내가 CalendarEntry 인스턴스에서이 피드 URL을 얻을 수있는 방법 CalendarEntry구글 캘린더 자바 API를
내가 http://www.google.com/calendar/feeds/[email protected]/allcalendars/full 모든 일정
의 피드 URL 것을 알고의 객체를 가지고 있지만?지정된 캘린더에 새 항목을 게시하고 싶기 때문에이 URL이 필요합니다.
감사합니다.
난 당신이 다음 코드와 같은 코드에서 해당 URL을 지정하는 것이 좋습니다 :
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()가 작동하지 않습니다. –
pccCalendar.getEditLink(). getHref()는 캘린더가 공개적으로 액세스 가능하다고 설정되지 않으면 작동하지 않습니다 (제 생각 엔) – user467257
올바르게, 당신은이 작업을 수행 할 수 :
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);
}
}
저주 구글을 자신이 들렸 혼란 캘린더 API에 대한.
코드를 게시 할 수 있습니까? – systempuntoout
당신이 이것을 알아 냈습니까? –