谷歌开放Calendar API,允许你添加Google Drive文件至Calendar事件

Google Calendar API允许你创建和修改Google Calendar上的事件。从今天开始,你可以使用API来添加Google Drive文件至Calendar事件,在你的App上实现,从而提高可用性和集成性。有了这个API你可以轻松地连接会议记录、添加预定好的PDFs至事件。

这里是设置方法:

  1. 从Google Drive获得文件信息(例子,通过Google Drive API):
GET https://www.googleapis.com/drive/v2/files

{
 ...
 "items": [
  {
   "kind": "drive#file",
   "id": "9oNKwQI7dkW-xHJ3eRvTO6Cp92obxs1kJsZLFRGFMz9Q,
   ...
   "alternateLink": "https://docs.google.com/presentation/d/9oNKwQI7dkW-xHJ3eRvTO6Cp92obxs1kJsZLFRGFMz9Q/edit?usp=drivesdk",
   "title": "Workout plan",
   "mimeType": "application/vnd.google-apps.presentation",
   ...
  },
  ...
 ]
}
  1. 使用Calendar API进行操作,实现此信息传送至事件:
POST https://www.googleapis.com/calendar/v3/calendars/primary/events?supportsAttachments=true

{
  "summary": "Workout",
  "start": { ... },
  "end": { ... },
  ...
  "attachments": [
   {
      "fileUrl": "https://docs.google.com/presentation/d/9oNKwQI7dkW-xHJ3eRvTO6Cp92obxs1kJsZLFRGFMz9Q/edit?usp=drivesdk",
      "title": "Workout plan",
      "mimeType": "application/vnd.google-apps.presentation"
   },
   ...
  ]
}

图片描述

看!你不需要做什么特别的操作就可实现啦,下一步:

GET https://www.googleapis.com/calendar/v3/calendars/primary/events/ja58khmqndmulcongdge9uekm7

{
 "kind": "calendar#event",
 "id": "ja58khmqndmulcongdge9uekm7",
 "summary": "Workout",
 ...
 "attachments": [
  {
   "fileUrl": "https://docs.google.com/presentation/d/9oNKwQI7dkW-xHJ3eRvTO6Cp92obxs1kJsZLFRGFMz9Q/edit?usp=drivesdk",
   "title": "Workout plan",
   "mimeType": "application/vnd.google-apps.presentation",
   "iconLink": "https://ssl.gstatic.com/docs/doclist/images/icon_11_presentation_list.png"
  },
  ...
 ]
}

看 Google Calendar API 文件上的指南和参考以获得更多的细节。

反馈途径:在StackOverflow.com上使用
tag #google-calendar即可。


英文原文:Attach Google Drive files to Calendar events with the Calendar API

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值