开发者

Google Calendar API

开发者 https://www.devze.com 2023-04-10 05:49 出处:网络
I have the code: // Create a CalenderService and authenticate CalendarService myService = new CalendarS开发者_如何学运维ervice(\"exampleCo-exampleApp-1\");

I have the code:

// Create a CalenderService and authenticate
CalendarService myService = new CalendarS开发者_如何学运维ervice("exampleCo-exampleApp-1");
myService.setUserCredentials("j...@gmail.com", "mypassword");

// Send the request and print the response
URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
System.out.println("Your calendars:");
System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
System.out.println("\t" + entry.getTitle().getPlainText());
}

This code gives out the list of all calendars. At me - a box calendar, a calendar of birthdays of friends and a calendar of holidays. I need to receive all events occurring today - i.e. both my notes, and birthdays of friends, and holidays. How I am able to do it?


You need to execute a date range query starting and ending of that day. See
http://code.google.com/apis/calendar/data/2.0/developers_guide_java.html#RetrievingDateRange

(I'm not 100% sure , but I think with the url https://www.google.com/calendar/feeds/default/allcalendars/full you should get results for all your calendars)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号