从自动创建的活动中访问活动描述 - Google Calendar API

时间:2018-04-17 06:39:30

标签: google-api gmail-api google-calendar-api

对于我的项目,我试图从用户的Google日历中提取航班预订信息。

我需要的关键信息是航班确认号,它存储在活动的描述中。

calendar preview

这是来自事件:获取

的回复
   "kind": "calendar#event",
   "etag": "\"3043267198652000\"",
   "id": "_6tlnaq...o6e",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=XzZ0...QG0",
   "created": "2018-03-07T00:12:22.000Z",
   "updated": "2018-04-04T23:47:36.112Z",
   "summary": "Flight to Sydney (PX 1)",
   "description": "To see detailed information for automatically created events like this one, use the official Google Calendar app. https://g.co/calendar",
   "location": "Port Moresby POM",
   "creator": {
    "email": "inceptable@gmail.com",
    "self": true
   },
   "organizer": {
    "email": "unknownorganizer@calendar.google.com"
   },
   "start": {
    "dateTime": "2018-04-21T15:00:00+10:00"
   },
   "end": {
    "dateTime": "2018-04-21T18:55:00+10:00"
   }

此消息的说明已替换为此消息:

"To see detailed information for automatically created events like this one, use the official Google Calendar app. https://g.co/calendar"

我一直无法找到有关为何会发生这种情况的任何信息。

Forum post with same problem

我的解决方法是使用 Gmail API 来阅读用户'发送电子邮件并使用正则表达式提取航班确认号码。

这不是优选的,因为它容易出错并需要用户的许可才能阅读他们的电子邮件。 我宁愿让Google提取这些信息,因为他们已经这样做了。

是否可以从自动创建的活动中访问此信息? 如果没有,为什么Google会限制此信息?

1 个答案:

答案 0 :(得分:1)

您需要了解Google Calendar API只能显示其所拥有的信息。有关事件的描述是

  

“要查看此类自动创建活动的详细信息,请使用官方Google日历应用。https://g.co/calendar

现在,如果这是由谷歌创建的事件,并且他们已将Google日历网络应用程序设置为以不同方式解析信息,那么您无法做任何改变。这毕竟是免费服务。

如果我在Extended properties尝试挖掘,我可能会在那里。但是,我不记得扩展属性是否是应用程序特定的,通过锁定它只有谷歌能够看到它。

  

是否可以从自动创建的事件中访问此信息?

除非数据在某些地方的扩展属性中被隐藏。

  

如果没有,为什么Google会限制此信息?

我的猜测是因为他们希望用户使用他们的应用程序,以便他们开始销售广告。