链接以添加到Google日历

时间:2012-05-07 20:41:59

标签: google-calendar-api

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

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

http://screencast.com/t/6vvh1khS

4 个答案:

答案 0 :(得分:194)

以下是您可以用来查看格式的示例链接:

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 编辑:此链接不再为您提供可以使用的表单

答案 1 :(得分:5)

我也成功使用了该网址结构:

基本网址:

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日期并排除timezone参数,例如:

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

答案 2 :(得分:4)

有适用于Google日历和其他日历服务的全面文档: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

答案 3 :(得分:3)

对于下一个搜索该主题的人,我编写了一个NPM小型软件包,以简化生成Google日历网址的过程。它包括TypeScript类型定义,供需要的人使用。希望对您有帮助!

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

相关问题