【问题标题】:How to list/ get events from a shared (non-primary) calendar using google api php client library for service account?如何使用服务帐户的 google api php 客户端库从共享(非主)日历中列出/获取事件?
【发布时间】:2013-04-03 09:07:24
【问题描述】:

我正在使用 google-api-php-client-0.6.1 (API v3) 从服务帐户的共享(非主要)日历中列出/获取事件?我可以使用以下设置通过 API 发出请求:

client id: xxx.apps.googleusercontent.com
service account name: xxx@developer.gserviceaccount.com
my google account is: yyy@gmail.com

我想做的是从 yyy@gmail.com 的日历中插入/列出/获取事件。

当我执行以下操作时,它会起作用:

$events = $service->events->listEvents('primary');

但是,当我执行以下操作时,它不起作用:

$events = $service->events->listEvents('yyy@gmail.com');

我收到一个错误“服务响应中的 json 无效”,任何人都可以提供任何帮助吗?


(也将我的问题发布在google group

【问题讨论】:

  • 嗨,有人可以帮忙解决上述问题吗?

标签: php google-api google-calendar-api google-api-php-client


【解决方案1】:

一个电子邮件地址可以有很多与之关联的日历。 listEvents() 接受其中一个日历 ID 作为参数。

如果您转到日历的设置,可以找到它,在底部您会看到“日历地址”,其中包含“(日历 ID:abcdefghijklmnopqrstuvwxyz@group.calendar.google.com)”。

【讨论】:

  • 感谢 allicarn,我尝试将日历 ID 作为参数:$service->events->insert(CALENDAR_ID, $event);但仍然显示错误,您或任何人可以帮助解决这个问题吗?提前谢谢..
  • 我不确定,您所拥有的似乎与文档匹配(developers.google.com/google-apps/calendar/v3/reference/events/… > PHP)。我会尝试使用和不使用“@group.calendar.google.com”。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-04-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-05
  • 1970-01-01
相关资源
最近更新 更多