简体   繁体   English

Google API(Javascript)-将日历手动添加到calendarList

[英]Google API (Javascript) - Add calendar to calendarList manually

So I'm currently using the Google API Javascript and have run into a bit of a problem. 所以我目前正在使用Google API Javascript ,但遇到了一些问题。 I am manually building a calendar by first calling gapi.client.calendar.calendarList.list which gives me a list of accessible calendars to pull information from (ie. event data). 我通过首先调用gapi.client.calendar.calendarList.list来手动构建日历,该日历为我提供了可访问日历的列表,以从中提取信息(即事件数据)。 However, for whatever reason this requires the user to have first added the calendar to the "Other Calendars" section of the Calendar. 但是,无论出于何种原因,这都要求用户首先将日历添加到日历的“其他日历”部分。 (See attached photo) . (见附图)

Since this requires too much grief on the end-user, I was wondering if I could add in the calendar to calendarList manually using the calendar's resource id / email address. 由于这会给最终用户带来太多麻烦,我想知道是否可以使用日历的资源ID /电子邮件地址将日历手动添加到calendarList

I was looking at gapi.client.calendar.calendarList.update , but it doesn't seem to work as advertisted. 我当时在看gapi.client.calendar.calendarList.update ,但它似乎不像广告那样工作。 Does anyone have any experience with manually loading a calendar into calendarList so that it can be called by calendarList.list and ultimately deliver event information? 是否有人有任何手动将日历加载到calendarList以便可以由calendarList.list调用并最终传递事件信息的经验?

Yes this is possible. 是的,这是可能的。 The Calendars.insert allows one to manually create a secondary calendar and be added to their "My calendars" account or any specified calendar. Calendars.insert允许手动创建辅助日历,并将其添加到其“我的日历”帐户或任何指定的日历中。 Here are all the properties. 这是所有属性。

  • id: Identifier of the calendar. id:日历的标识符。
  • summary: Title of the calendar. 摘要:日历的标题。
  • timeZone: The time zone of the calendar. timeZone:日历的时区。 Optional. 可选的。
  • description: Description of the calendar. description:日历的描述。 Optional. 可选的。
  • location: Geographic location of the calendar as free-form text. location:日历的地理位置,为自由格式的文本。 Optional. 可选的。
  • kind: Type of the resource ("calendar#calendar"). kind:资源的类型(“ calendar#calendar”)。
  • etag: ETag of the resource. etag:资源的ETag。

You can Try-it to make sure it is working as you expected. 您可以尝试一下以确保它按预期工作。 Hope this helps and Good luck! 希望这会有所帮助,祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM