如何从Google Calendar API获取别名电子邮件

时间:2017-05-18 18:30:01

标签: email google-api mailing-list google-calendar-api

使用Google Calendar API,我可以通过GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId获取活动的所有与会者。

在我的日历活动中,我使用别名team@mycompany.com向整个团队组织发送电子邮件。不幸的是,我的日历事件返回别名,而不是单个电子邮件,如下所示:

"attendees": [
  {
   "email": "me@mycomapny.com",
   "self": true,
   "responseStatus": "accepted"
  },
  {
   "email": "team@mycomapny.com",      <-- Not what I want
   "displayName": "My Entire Company",
   "responseStatus": "needsAction"
  },
],

如何获得扩展的与会者列表,如下所示:

"attendees": [
  {
   "email": "me@mycomapny.com",
   "self": true,
   "responseStatus": "accepted"
  },
  {
   "email": "you@mycomapny.com",    <-- expanded email list
   "responseStatus": "needsAction"
  },
  {
   "email": "someoneelse@mycomapny.com",
   "responseStatus": "needsAction"
  },
  {
   "email": "manager@mycomapny.com",
   "responseStatus": "needsAction"
  },
  ... etc
],

1 个答案:

答案 0 :(得分:0)

  

我使用别名team@mycompany.com向整个团队组织发送电子邮件。

如果您要将team@mycompany.com添加到活动中,那么这正是您要添加的内容。日历无法知道电子邮件是邮件列表。如果您希望列出每个人,那么您将不得不将每个人添加到活动中。 Google日历只能返回您提供的信息。

答案:创建添加每个用户的活动时,请勿使用邮件列表。否则谷歌日历无法知道这是一个邮件列表。正如我所看到的那样谷歌日历正在返回正确的数据。