将单个 Google 日历事件导出到 ICS?
我目前正在研究在网页上显示多个 Google 日历的事件列表的可能性。目前,我正在使用 WordPress 的 Google 日历事件插件来显示网站上的事件(开发网站位于防火墙后面,因此我无法共享链接);但我想看看是否有任何简单的方法可以为每个单独的事件动态生成 ICS 文件。
我们希望允许网站访问者将单个事件添加到他们的日历中,但 Google 日历数据 API 似乎只提供以 ICS 格式下载整个日历的选项。我尝试简单地将带有 eid(事件 ID)的查询字符串附加到 ICAL 提要地址的末尾,但这仍然会打开标准的 Google ICAL 提要,其中包括日历中当前包含的所有事件。
我对从头开始动态构建 ICS 文件有些熟悉,并且过去曾经做过一次,从本地 Perl 日历程序中提取事件并为每个事件生成一个 ICS 文件;但如果有任何预先构建的 API 或 PHP 类已经设置为从各个 Google 日历活动构建 ICS 文件,我更愿意使用它们。
I am currently looking into the possibility of displaying lists of events from multiple Google Calendars on a Web page. At the moment, I'm using the Google Calendar Events plugin for WordPress to display the events on the site (development site behind a firewall, so I can't share a link); but I'd like to see if there's any simple method to dynamically generate ICS files for each individual event.
We would like to allow the website visitors to add individual events to their calendars, but the Google Calendar Data API only seems to provide the option to download an entire calendar in ICS format. I tried simply appending a query string with the eid (event ID) to the end of the ICAL feed address, but that still opens the standard Google ICAL feed, which includes all of the events currently included on the calendar.
I am somewhat familiar with dynamically building ICS files from scratch, and have done it once in the past, pulling events from a local Perl calendar program and generating an ICS file for each event; but if there are any pre-built APIs or PHP classes that are already set up to build ICS files from individual Google Calendar Events, I'd much prefer to use those.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
它是如此简单,实际上只是一个页面,试试这个:(当然,你需要替换你自己的变量......)
Its so simple its just a page really, try this: (you'll need to substitute you own variables of course ...)
我通过谷歌找到了一些 PHP 库,全部都是 PHP 的,我敢打赌还有更多:
Some PHP Libraries I was able to dig up via google, all for PHP, I bet there are even more:
我意识到这是多么陈旧 - 但它在阴险的搜索引擎如何获取单个事件的ICS的排名中几乎名列前茅 - 上述内容都不适合我,也许这并不奇怪该线程有多老。
我的解决方案 - 创建一个特殊的日历来导出单个事件 - 复制要导出到该日历的事件 - 导出日历 - 然后删除这些事件,以便下次使用它 - 我能够将单个事件导入到 T'bird 。
我意识到导出仅包含 1 个事件的日历与导出单个事件不太一样(或者也许是),但这似乎是一个有用的解决方法。
I realise how stale this is - but it came near top of the insidious search engine's ranking of how to get an ics of an individual event - none of the above worked for me, perhaps not surprisingly how old the thread is.
My solution - create a special calendar for the export of individual events - copy events you want exported to that calendar - export the calendar - then delete the events so it's clean for the next time - I was able to import individual events to T'bird.
I realise exporting a calendar with only 1 event in it is not quite the same as exporting a single event (or, perhaps it is) but it seems a useful work around.
我还想为单个事件生成 .ics 文件。我不想搞乱 PHP,所以我打算使用 grymala 的技巧。不幸的是,我不知道要导出的事件的 calendarID,因此我导出了所有 gcal 的日历并编辑了生成的文件,使其仅包含日历标题、页脚和 vevent lsiting。我还删除了日历名称,我想我不知道这是否有必要。
我从未像gymala建议的那样找到获取特定日历的网址的方法,但我确实根据此帮助文本。
在页面左侧的日历列表中,移动鼠标
在您要从中导出的日历上。
您会看到日历名称旁边出现一个下拉箭头。单击下拉箭头并选择日历设置。 (或者,单击“我的日历”旁边的下拉箭头并选择“设置”,然后从列表中单击相应的日历。)
单击页面底部“私人地址”部分中的 ICAL 按钮,然后单击显示的 URL。
将导出的文件保存到计算机上所需的文件夹中。 ,可以将该 URL 粘贴到另一个浏览器窗口中,复制窗口文本,然后将其粘贴到编辑器中。
I also wanted to generate a .ics file for a single event. I didn't want to mess with PHP so I was going to use grymala's tip. Unfortunately I did not know the calendarID for the event I wanted to export so I exported all gcal's calendars and edited the resulting file so that it only contained the calendar heading, footing, and vevent lsiting. I also deleted the calendar name thought I don't know if this was necessary.
I never did find out a way to get the url for a specific calendar as gymala suggested but I did find this based on this help text.
In the calendar list on the left side of the page, move your mouse
over the calendar you'd like to export from.
You'll see a drop-down arrow appear next to the calendar name. Click the drop-down arrow and select Calendar settings. (Alternatively, click the drop-down arrow next to My calendars and select Settings, then click the appropriate calendar from the list.)
Click the ICAL button in the 'Private Address' section at the bottom of the page, and click the displayed URL.
Save the exported file to the desired folder on your computer. , possibly by pasting that URL into another browser window, copying the window text,and pasting it into an editor.