gpt4 book ai didi

java - 谷歌日历 API (Java)

转载 作者:行者123 更新时间:2023-12-02 08:13:06 25 4
gpt4 key购买 nike

如何获取我检索的事件的日期/时间?

CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("username@gmail.com", "pwd");
URL feedUrl = new URL("https://www.google.com/calendar/feeds/username@gmail.com/public/full");

CalendarQuery myQuery = new CalendarQuery(feedUrl);
myQuery.setFullTextQuery("Query");
CalendarEventFeed myResultsFeed = myService.query(myQuery,
CalendarEventFeed.class);

for (int i=0; i < myResultsFeed.getEntries().size(); i++)
{
CalendarEventEntry firstMatchEntry = (CalendarEventEntry) myResultsFeed.getEntries().get(i);
String myEntryTitle = firstMatchEntry.getTitle().getPlainText();
System.out.println(myEntryTitle + " " + firstMatchEntry.getPlainTextContent());
System.out.println(""+firstMatchEntry.getAuthors().get(0).getEmail());
System.out.println(""+firstMatchEntry.getPublished());
System.out.println(""+firstMatchEntry.getHtmlLink().getHref());
System.out.println(""+firstMatchEntry.getStatus().getValue());
}

我找不到从 CalendarEventEntry 获取更多有用信息的方法。

LE:问题已解决;看到这个后:

http://code.google.com/apis/calendar/data/1.0/developers_guide_php.html#RetrievingEvents

我得到了这个:

System.out.println("start time = "+firstMatchEntry.getTimes().get(0).getStartTime());
System.out.println("start time = "+firstMatchEntry.getTimes().get(0).getEndTime());

好消息是示例因语言而异。

最佳答案

问题已解决;看到这个后:

http://code.google.com/apis/calendar/data/1.0/developers_guide_php.html#RetrievingEvents

我做到了:

System.out.println("start time = "+firstMatchEntry.getTimes().get(0).getStartTime());
System.out.println("start time = "+firstMatchEntry.getTimes().get(0).getEndTime());

关于java - 谷歌日历 API (Java),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6995495/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com