添加到谷歌日历的链接

我不清楚确切的格式有一个网站上的链接,将添加一个单一的事件到用户谷歌日历。我看到 eventbrite 已经在这里做了,但我希望在正确的方向上有一些明确的规格或链接

Http://www.eventbrite.com/event/1289487893

Http://screencast.com/t/6vvh1khs

161158 次浏览

下面是一个示例链接,您可以使用它查看格式:

Https://www.google.com/calendar/render?action=template&text=your+event+name&dates=20140127t224000z/20140320t221500z&details=for+details,+link+here:+http://www.example.com&location=waldorf+astoria,+301+park+ave+,+new+york,+ny+10022&sf=true&output=xml

注意关键查询参数:

text
dates
details
location

下面是另一个例子(取自 http://wordpress.org/support/topic/direct-link-to-add-specific-google-calendar-event) :

<a href="http://www.google.com/calendar/render?
action=TEMPLATE
&text=[event-title]
&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']
&details=[description]
&location=[location]
&trp=false
&sprop=
&sprop=name:"
target="_blank" rel="nofollow">Add to my calendar</a>

如果你愿意,这里有一个表格可以帮助你建立这样一个链接(在前面的答案中提到过) :

Https://support.google.com/calendar/answer/3033039 编辑: 这个链接不再提供您可以使用的表单

有一个全面的文件谷歌日历和其他日历服务: https://github.com/InteractionDesignFoundation/add-event-to-calendar-docs/blob/master/services/google.md

工作链接的一个例子: https://calendar.google.com/calendar/render?action=TEMPLATE&text=Bithday&dates=20201231T193000Z/20201231T223000Z&details=With%20clowns%20and%20stuff&location=North%20Pole

我在这个 URL 结构上也取得了成功:

基本网址:

https://calendar.google.com/calendar/r/eventedit?

这是我的活动细节:

Title: Event Title
Description: Example of some description. See more at https://stackoverflow.com/questions/10488831/link-to-add-to-google-calendar
Location: 123 Some Place
Date: February 22, 2020
Start Time: 10:00am
End Time: 11:30am
Timezone: America/New York (GMT -5)

我会将我的详细信息转换成这些参数(URL 编码) :

text=Event%20Title
details=Example%20of%20some%20description.%20See%20more%20at%20https%3A%2F%2Fstackoverflow.com%2Fquestions%2F10488831%2Flink-to-add-to-google-calendar
location=123%20Some%20Place%2C%20City
dates=20200222T100000/20200222T113000
ctz=America%2FNew_York

示例链接:

Https://calendar.google.com/calendar/r/eventedit?text=event%20title&details=example%20of%20some%20description.%20see%20more%20at%20https%3a%2f%2fstackoverflow.com%2fquestions%2f10488831%2flink-to-add-to-google-calendar&location=123%20some%20place%2c%20city&dates=20200222t100000/20200222t113000&ctz=america%2fnew_york

请注意,由于我使用“ ctz”参数指定了一个时区,因此我使用本地时间作为开始和结束日期。或者,可以使用 UTC 日期并排除时区参数,如下所示:

dates=20200222T150000Z/20200222T163000Z

示例链接:

Https://calendar.google.com/calendar/r/eventedit?text=event%20title&details=example%20of%20some%20description.%20see%20more%20at%20https%3a%2f%2fstackoverflow.com%2fquestions%2f10488831%2flink-to-add-to-google-calendar&location=123%20some%20place%2c%20city&dates=20200222t150000z/20200222t163000z

对于下一个用 Google 搜索这个主题的人,我已经编写了一个小的 NPM 包,使得生成 Google Calendar URL 变得简单。它包含 TypeScript 类型定义,以满足需要。希望能有帮助!

Https://www.npmjs.com/package/google-calendar-url