如何构建指向 google 日历事件的 html 链接? [英] How to build html link to a google calendar event?

查看:22
本文介绍了如何构建指向 google 日历事件的 html 链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用谷歌日历 API v3,我向谷歌日历添加了一个事件.现在我想建立一个 html 链接,以便有人可以点击并查看日历事件.

Using the google calendar API v3, I added an event to a google calendar. Now I want to built an html link so that someone can click and view the calendar event.

这是我尝试过的:

<a href="https://www.google.com/calendar/feeds/default/private/full/{{ event.googleID }}">查看 Google</a>

href 看起来像:
https://www.google.com/calendar/feeds/default/private/full/bigstringhere1ovmuup7mjf0

问题是我收到 401 错误需要授权"

Problem is I get a a 401 Error "Authorization Required"

如何根据谷歌日历 ID 建立一个链接来查看/编辑日历事件?

How can I build a link to view/edit the calendar event based on a google calendar ID?

推荐答案

有办法!要查看公共日历活动,请使用以下形式的链接:

There is a way! To view a public calendar event, use a link of the form:

https://www.google.com/calendar/event?eid={event-id}&ctz={timezone}

其中 {event-id} 是唯一事件 ID,{timezone}这些时区.

where {event-id} is the unique event id, and {timezone} is one of these time zones.

这里是一个例子:.

Here's an example: link to a specific public calendar event.

如果您对该活动所来自的日历拥有编辑权限,您将能够编辑该活动并查看来宾列表.否则,您只会看到有关该活动的公开信息.

If you have editing rights to the calendar this event is from, you will be able to edit the event and see the guest list. Otherwise, you just see the public information about the event.

由于确定事件 ID 可能很困难,这里有一个小书签,可在您编辑其详细信息页面时生成指向您的 Google 日历事件的链接:

Since it can be difficult to determine the event id, here's a bookmarklet that produces a link to your Google Calendar event when you are editing its Details page:

javascript:(function(){ try { window.prompt('Shareable link to this event:','https://www.google.com/calendar/event?eid='+document.getElementsByClassName('ep')[0].getAttribute('data-eid')) } catch (e) {alert("Use this bookmarklet to get a shareable link to a Google Calendar event when editing its Details page.")}})()

此书签的一个版本适用于新的(截至 2017 年)Google 日历 UI:

And a version of this bookmarklet which works with the new (as of 2017) Google Calendar UI:

javascript:(function(){ 
  window.prompt('Shareable link to this event:',
    'https://www.google.com/calendar/event?eid='+
    window.location.href.split("/").pop().split("?")[0])
})()

(也可能有用,如何链接到公共 Google 日历的特定:

(Also possibly useful, how to link to a specific day of a public Google calendar:

https://www.google.com/calendar/embed?src={calendar-id}&mode=day&dates={yyyymmdd}%2F{yyyymmdd}

其中 {calendar-id} 是日历的 ID,{yyyymmdd} 是您要链接到的日期.

where {calendar-id} is the calendar's id and {yyyymmdd} is the day you want to link to.

可选参数包括时区和是否显示各种项目,例如:

Optional parameters include the time zone and whether to display various items, for example:

&ctz=Asia/Taipei&showNav=0&showPrint=0&showCalendars=0

示例:链接到公共日历的单日.)

这篇关于如何构建指向 google 日历事件的 html 链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆