G Suite帐户在Calendar API中缺少displayName参数

时间:2018-02-27 15:08:36

标签: google-api google-calendar-api gsuite

我正在创建一个应用程序,使用他们的API从Google日历中获取日历事件。但是,我无法获取G Suite帐户的creator.displayName参数。为了排除我的代码中的内容,我只是从calendar.google.com网站创建了一个日历事件,然后转到API资源管理器(https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.list)来查看该事件。

事实证明,G Suite 用户没有displayName参数,但资源和标准Google日历用户都有。

对于G Suite 资源帐户,我得到类似的内容:

   {
   "kind": "calendar#event",
   "etag": "\"123456789220000\"",
   "id": "<unique-ID-here>",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=unique-eid-link-here",
   "created": "2018-02-27T13:00:07.000Z",
   "updated": "2018-02-27T13:00:07.160Z",
   "summary": "Event Name",
   "creator": {
    "email": "admin@gsuitedomain.com"
   },
   "organizer": {
    "email": "gsuitedomain.com_uniqueidentifier@group.calendar.google.com",
    "displayName": "A Resource Account",
    "self": true
   },
   "start": {
    "dateTime": "2018-02-27T05:52:00-08:00"
   },
   "end": {
    "dateTime": "2018-02-27T06:00:00-08:00"
   },
   "iCalUID": "unique-uid-here@google.com",
   "sequence": 0,
   "reminders": {
    "useDefault": true
   }

对于个人帐户,我得到:

   {
   "kind": "calendar#event",
   "etag": "\"1234567890015265\"",
   "id": "unique-id-here",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=unique-eid-here",
   "created": "2018-02-27T13:00:04.000Z",
   "updated": "2018-02-27T13:00:05.014Z",
   "summary": "Event Name 2",
   "creator": {
    "email": "personal-gmail@gmail.com",
    "displayName": "John Doe",
    "self": true
   },
   "organizer": {
    "email": "personal-gmail@gmail.com",
    "displayName": "John Doe",
    "self": true
   },
   "start": {
    "dateTime": "2018-02-27T08:00:00-05:00"
   },
   "end": {
    "dateTime": "2018-02-27T09:00:00-05:00"
   },
   "iCalUID": "unique-id-here@google.com",
   "sequence": 0,
   "reminders": {
    "useDefault": true
   }
  }

在组织者下显示displayName的位置。但对于管理员或GSuite中的任何用户,我得到以下内容:

   {
   "kind": "calendar#event",
   "etag": "\"123459678950000\"",
   "id": "unique-id-here",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=unique-eid-here",
   "created": "2018-02-27T14:00:14.000Z",
   "updated": "2018-02-27T14:00:24.391Z",
   "summary": "Event Name 3",
   "creator": {
    "email": "admin@gsuitedomain.com",
    "self": true
   },
   "organizer": {
    "email": "admin@gsuitedomain.com",
    "self": true
   },
   "start": {
    "dateTime": "2018-02-27T07:30:00-08:00"
   },
   "end": {
    "dateTime": "2018-02-27T08:00:00-08:00"
   },
   "iCalUID": "unique-id-here@google.com",
   "sequence": 0,
   "reminders": {
    "useDefault": true
   }

我错过了什么吗?为什么G Suite用户默认不使用displayName参数?

1 个答案:

答案 0 :(得分:0)

对任何正在努力解决这个问题的人

个人用户身份信息与为该用户创建的Google+个人资料相关联。 Google+已针对G Suite域启用,但也必须为每个用户启用该服务。

设置G +配置文件后,displayName将可用。