【问题标题】:G Suite Account missing displayName parameter in Calendar APIG Suite 帐户在日历 API 中缺少 displayName 参数
【发布时间】:2018-08-07 06:57:12
【问题描述】:

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

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

对于 G Suite Resource 帐户,我得到如下信息:

   {
   "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
   }
  }

显示名称在管理器下方明显。但是对于管理员或 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 参数?

【问题讨论】:

  • 您是否尝试在“字段参数”中提供 displayName(只需遵循正确的格式)?您也可以尝试提供“*”来表示您希望返回每个属性。
  • 如果我将其限制为仅摘要和 Organizer.displayName,它将仅返回摘要和 displayName 的空值。我注意到 API 说“返回组织者的名称,如果可用”,但我不知道是什么使它可用或不可用。
  • “不可用”可能意味着“组织者的名称”尚未提供。

标签: google-api google-calendar-api google-workspace


【解决方案1】:

致所有为此苦苦挣扎的人-

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

设置 G+ 个人资料后,displayName 将可用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-24
    • 2020-01-20
    相关资源
    最近更新 更多