gpt4 book ai didi

javascript - Google Javascript Data API for Calendar - 事件时间不可用

转载 作者:行者123 更新时间:2023-11-30 13:42:30 24 4
gpt4 key购买 nike

我想使用 gdata API 从公共(public)日历提要中检索一些事件条目。这是我正在使用的代码:

var calendarService = new google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0');

var feedUri = 'http://www.google.com/calendar/feeds/.../public/basic';
var gquery = new google.gdata.calendar.CalendarEventQuery(feedUri);

gquery.setFutureEvents(true);
gquery.setMaxResults(10);

var callback = function(result) {
var entries = result.feed.entry;
for (var i = 0; i < entries.length; i++ ) {
var entry = entries[i];
var title = entry.getTitle().getText();
var times = entry.getTimes();
alert("Title: " + title + " | Times: " + times);
}
}
calendarService.getEventsFeed(gquery, callback);

(供稿 URI 是 Google Apps 日历的公共(public)(或私有(private))XML 供稿)

我希望在 times 中找到事件时间,但它是一个空数组。这在某种程度上是合乎逻辑的,因为 feedUri 中的实际提要不包含任何时间信息。

问题:

  • 我做错了什么?如何检索包含事件时间的日历条目?
  • 如果 getTimes() 完全没用,为什么会有方法?

最佳答案

编辑:我刚刚看到您使用的是“基本”提要 - 您是否尝试过“完整”提要?基本提要的描述是:

Basic Atom feed without any extension elements. Its and properties contain pre-rendered HTML.

此外,您需要了解单一事件与重复事件。可通过 getRecurrence() 获取有关重复事件的信息。对于个别事件,getTimes() 将提供正确的信息。

如果您没有通过 API 看到信息,请尝试直接查看源数据,看看是否可以在那里看到。

关于javascript - Google Javascript Data API for Calendar - 事件时间不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1523862/

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