Php 谷歌日历可以´;得不到彩色ID
有人知道如何从谷歌日历事件中获取colorId吗?我在网上搜索了很多,但没有找到任何有用的东西。我需要帮助 我的代码工作得很好,但是关于colorId总是接收NULL 我知道我们有$cal->colors->get()方法,但这不是我想要的。我想要每个事件的颜色 这是我的密码:Php 谷歌日历可以´;得不到彩色ID,php,google-api,google-calendar-api,google-api-php-client,Php,Google Api,Google Calendar Api,Google Api Php Client,有人知道如何从谷歌日历事件中获取colorId吗?我在网上搜索了很多,但没有找到任何有用的东西。我需要帮助 我的代码工作得很好,但是关于colorId总是接收NULL 我知道我们有$cal->colors->get()方法,但这不是我想要的。我想要每个事件的颜色 这是我的密码: $client = new Google_Client(); $client->setApplicationName("Ware"); $client->setDeveloperKey('CalendarKe
$client = new Google_Client();
$client->setApplicationName("Ware");
$client->setDeveloperKey('CalendarKey');
$cal = new Google_Service_Calendar($client);
$params = array(
'singleEvents' => true,
'orderBy' => 'startTime'
);
$events = $cal->events->listEvents($calendarId, $params);
$calTimeZone = $events->timeZone;
$events = $cal->events->instances($calendarId, "eventId");
date_default_timezone_set($calTimeZone);
$jsonEvents = json_encode($events->getItems());
$outerArray = array();
$innerArray = array();
foreach ($events->getItems() as $event) {
$date = $event->start->date;
if (!isset($date)) {
$date = $event->start->dateTime;
}
$endDate = $event->end->dateTime;
if (!isset($endDate)) {
$endDate = $event->end->date;
}
$array = array(
"title" => $event->summary,
"description" => $event->description,
"id" => $event->id,
"location" => $event->location,
"start" => $date,
"end" => $endDate,
"colorId" => $event->colorId
);
array_push($outerArray, $array);
}
echo json_encode($outerArray);
“colorId”=>$event->colorId始终为空
公共日历已打开,我有权“进行更改并管理共享”
如何解决这个问题?
谢谢不幸的是,这似乎是有意的行为。看到这个(但标记为不会修复)和这个。好的,谢谢。这太愚蠢了,但为什么!?我真的很需要,我会看看能做些什么。