创建“添加到 Google 日历”链接需要什么参数?

我们可以用这个 链接add a new eventGoogle Calendarparameters

https://www.google.com/calendar/render?
action=TEMPLATE&
text=EventName&
dates=20131206T050000Z/20131208T060000Z
&location=EventLocation&
sprop=name:Name&
sprop=website:EventWebite&
details=EventDetail&
sf=true&
output=xml

但我找不到任何关于这些参数的文档。

有人知道在哪吗?

40069 次浏览

Explanation about the available parameters:

anchor address:
http://www.google.com/calendar/event?
This is the base of the address before the parameters below.




action:
action=TEMPLATE
A default required parameter.
    

src:
Example: src=default%40gmail.com
Format: src=text
This is not covered by Google help but is an optional parameter
in order to add an event to a shared calendar rather than a user's default.
    

text:
Example: text=Garden%20Waste%20Collection
Format: text=text
This is a required parameter giving the event title.
    

dates:
Example: dates=20090621T063000Z/20090621T080000Z
(i.e. an event on 21 June 2009 from 7.30am to 9.0am
British Summer Time (=GMT+1)).
Format: dates=YYYYMMDDToHHMMSSZ/YYYYMMDDToHHMMSSZ
This required parameter gives the start and end dates and times
(in Greenwich Mean Time) for the event.
    

location:
Example: location=Home
Format: location=text
The obvious location field.
    

trp:
Example: trp=false
Format: trp=true/false
Show event as busy (true) or available (false)
    

sprop:
Example: sprop=http%3A%2F%2Fwww.me.org
Example: sprop=name:Home%20Page
Format: sprop=website and/or sprop=name:website_name


add:
Example: add=default%40gmail.com
Format:  add=guest email addresses


details: (extra)
Example: details=Event%20multiline%0Adetails
Format:  details=description text (google also accepts html in this text)

http://useroffline.blogspot.com/2009/06/making-google-calendar-link.html

The link from snoopy_15's answer points to an old Google URL that is currently being redirected to the new Google support page. This new page does not explain how to generate the kind of link asked in this question.

However, thanks to the wonders of Internet Archive: Wayback Machine, the older pages are still archived and available!

The latest available version is from March 2012, and it includes a form with a simple JavaScript code that still works! Sure, this is not an official documentation (and I'm still looking for one), and this is not even a documentation (it is an interactive form with a script), but it is the closest I could get.

You have one more param for specifying Guests

Add:
Example: add=default%40gmail.com
Format:  add=guest email addresses

Demo

https://productforums.google.com/forum/#!topic/calendar/Ovj6BNTQNL0

These are the parameters that I use when I create these links. There are other parameters that exist, but I don't find them useful and they are optional. The details about how the dates work are particularly vexing and were never sufficiently documented by google.

  • action=TEMPLATE (required)
  • text (url encoded name of the event)
  • dates (ISO date format, startdate/enddate - must have both start and end time or it won't work. The start and end date can be the same if appropriate.)
    • to use the user's timezone: 20161208T160000/20161208T180000
    • to use global time, convert to UTC, then use 20131208T160000Z/20131208T180000Z
    • all day events, you can use 20161208/20161209 - note that the old google documentation gets it wrong. You must use the following date as the end date for a one day all day event, or +1 day to whatever you want the end date to be.
  • details (url encoded event description/details)
  • location (url encoded location of the event - make sure it's an address google maps can read easily)