照常共享到服务帐户,从日历中查询日历时日历未出现在列表中 API

Shared as usual to service account, calendar does not appear in the list when querying it from Calendar API

我有大约 51 个 Google 日历共享到 google 服务帐户,它们仍然运行良好,我定期收到它们的推送通知。我以通常的方式添加了一个日历:"share to other people" 并将电子邮件设置为我的服务帐户。然后我试图获取连接到服务帐户的所有日历的列表,但我无法获取最新的。它不存在。

这是我过去 2-3 年使用的 Joomla php 代码:

public function loadCalendarList() {

    $this->user = JFactory::getUser();
    if ($this->_connect()) {
        **$list = $this->_service->calendarList->listCalendarList();**
        if (!empty($list['items'])) {
....

已加载除新日历之外的所有日历。 我在互联网上搜索过但没有线索, 我没有使用 G Suite。 如果我在没有任何服务帐户的情况下使用 google OAuth 2.0 授权,我可以用新日历加载所有 52 个日历。 还有一个想法:我已经好几个月没有添加到这个新日历了,我认为 google?

发生了一些变化

对于新共享的日历,在与服务帐户共享日历后,您需要将其明确插入到服务帐户的日历列表中。像这样:

$newCalendar=new Google_Service_Calendar_CalendarListEntry();
$newCalendar->setId("THE ID OF THE NEWLY ADDED CALENDAR");
$service->calendarList->insert($newCalendar);