在google apps脚本中获取链接(url)到日历事件 [英] Get link (url) to an calendar event in google apps script
问题描述
我在Google Apps Script中使用了日历活动,并且我想让用户通过点击一个锚来打开它。
我想我可以看到这样的网址: http://www.google.com/calendar/event?eid=SOMEID&ctz=Etc/GMT 。
但是我似乎无法从日历事件中获得所需的ID。我从Event.getId()获得的ID在这些URL中不起作用,并且没有event.getUrl()。
I have a Calendar Event in Google Apps Script and I want to allow the user to open it by clicking an Anchor. I think I can the URL has to look like this: http://www.google.com/calendar/event?eid=SOMEID&ctz=Etc/GMT . However I can't seem to get the required ID from the Calendar Event. The ID I get from Event.getId() doesn't work in those URL's and there is no event.getUrl().
有谁知道这是否可以使用apps脚本?
Does anyone know if this is possible with apps script?
推荐答案
对于给定事件
类型 CalendarEvent 并给出 calendarId
,那么在Google日历应用程序中构建用于查看/编辑相应事件的URL的最简单且有效的方法如下: p>
For given event
object of type CalendarEvent and given calendarId
, the simplest and working way to build an URL to view/edit corresponding event in Google Calendar App is the following:
var splitEventId = event.getId().split('@');
var eventURL = "https://www.google.com/calendar/event?eid=" + Utilities.base64Encode(splitEventId[0] + " " + calendarId);
最棒的是没有Google API调用,身份验证......需要!
The best thing is that no Google API invocation, authentication, ... needed!
这篇关于在google apps脚本中获取链接(url)到日历事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!