如何使用Calendar API V3获取事件详细信息 [英] How to get event details with calendar api v3
问题描述
我正在尝试使用最新的api检索事件详细信息,但没有找到任何示例. 这是我用于整理事件的代码:
I am trying to retrieve events details with the lastest api but I don't find any example. This is my code for retreiving events:
$service = new Google_Service_Calendar($client);
$events = $service->events->listEvents('email');
foreach ($events->getItems() as $event)
{
echo $event->getSummary()." ".$event->getId().": ".$event->getDescription()." "."<br><br>";
}
它可以工作,但是我找不到该函数来获取其他详细信息,例如开始时间和结束时间,这些功能是否在其中列出了?
It works but I don't find the function to get other details like start and end time, is there somewhere these functions are listed ?
谢谢
推荐答案
有关事件的Google Calendar API v3参考可以在以下位置找到:
The Google Calendar API v3 reference for event can be found here: https://developers.google.com/google-apps/calendar/v3/reference/events#resource
它列出了属于事件的完整属性集.
It list the full set of attributes which belong to an event.
要访问任何事件属性,请将get
添加到它的开头,然后对结果进行驼峰式显示.一些例子:
To get access to any event attribute, add get
to the start of it and camelcase the result. Some example:
$event.getSummary()
$event.getStatus()
$event.getVisibility()
如果您追求的值本身就是一个对象,则可以链接获取:
If the value you are after is an object itself then you can chain your gets:
$event.getStart().getDateTime()
$event.getOrganizer().getEmail()
这篇关于如何使用Calendar API V3获取事件详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!