Я использую учетную запись службы freebusy api Oauth2 и получаю следующий результат. Массив «Всегда занят» становится пустым, хотя я создал в своем календаре несколько событий. в чем может быть проблема
MyCode:
$items_arr = [
"xxxxx.com_3434343434xxxxxgb6oqjge1g6cpjed9g74@resource.calendar.google.com"
,
"xxxxx.com_454544dfdfv7v9q6gb6cpjacpg6kp36dpo6c@resource.calendar.google.com"
];
putenv('GOOGLE_APPLICATION_CREDENTIALS=meeting-room-app-4423234xx-5f984f6e1xew3634ds3rdtsdeeqdfe.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(Google_Service_Calendar::CALENDAR);
$client->addScope(Google_Service_Calendar::CALENDAR_READONLY);
$service = new Google_Service_Calendar($client);
$fnlItems=[];
for ($i=0; $i < count($items_arr); $i++) {
$item = new Google_Service_Calendar_FreeBusyRequestItem();
$item->setId($items_arr[$i]);
array_push($fnlItems, $item);
}
$timezone = "IST";
$freebusy_req = new Google_Service_Calendar_FreeBusyRequest();
$freebusy_req->setTimeMin(date(DateTime::ATOM, strtotime('2020-01-01T08:00:00.000Z')));
$freebusy_req->setTimeMax(date(DateTime::ATOM, strtotime('2020-01-31T17:00:00.000Z')));
$freebusy_req->setTimeZone($timezone);
$freebusy_req->setCalendarExpansionMax(10);
$freebusy_req->setGroupExpansionMax(10);
//$item='';
$fnlItems=[];
for ($i=0; $i < count($items_arr); $i++) {
$item = new Google_Service_Calendar_FreeBusyRequestItem();
$item->setId($items_arr[$i]);
array_push($fnlItems, $item);
}
$freebusy_req->setItems($fnlItems);
$results = $service->freebusy->query($freebusy_req);
// $response = $sqladmin->instances
// ->listInstances('meeting-room-app-265703')->getItems();
print_r($results); die;
Ниже приведен результат:
Google_Service_Calendar_FreeBusyResponse Object
(
[calendarsType:protected] => Google_Service_Calendar_FreeBusyCalendar
[calendarsDataType:protected] => map`enter code here`
[groupsType:protected] => Google_Service_Calendar_FreeBusyGroup
[groupsDataType:protected] => map
[kind] => calendar#freeBusy
[timeMax] => 2020-01-31T18:29:59.000Z
[timeMin] => 2019-01-01T18:30:00.000Z
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
[calendars] => Array
(
[xxxxx.com_188dql9c1ap8ssdqhvdfdsds1gb7ddr55aufhr726gb@resource.calendar.google.com] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => global
[reason] => notFound
)
)
[busy] => Array
(
)
)
Подробнее здесь: https://stackoverflow.com/questions/598 ... nse-object
Объект Google_Service_Calendar_FreeBusyResponse ⇐ Php
Кемеровские программисты php общаются здесь
-
Anonymous
1733789878
Anonymous
[b]Я использую учетную запись службы freebusy api Oauth2[/b] и получаю следующий результат. Массив «Всегда занят» становится пустым, хотя я создал в своем календаре несколько событий. в чем может быть проблема
MyCode:
$items_arr = [
"xxxxx.com_3434343434xxxxxgb6oqjge1g6cpjed9g74@resource.calendar.google.com"
,
"xxxxx.com_454544dfdfv7v9q6gb6cpjacpg6kp36dpo6c@resource.calendar.google.com"
];
putenv('GOOGLE_APPLICATION_CREDENTIALS=meeting-room-app-4423234xx-5f984f6e1xew3634ds3rdtsdeeqdfe.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(Google_Service_Calendar::CALENDAR);
$client->addScope(Google_Service_Calendar::CALENDAR_READONLY);
$service = new Google_Service_Calendar($client);
$fnlItems=[];
for ($i=0; $i < count($items_arr); $i++) {
$item = new Google_Service_Calendar_FreeBusyRequestItem();
$item->setId($items_arr[$i]);
array_push($fnlItems, $item);
}
$timezone = "IST";
$freebusy_req = new Google_Service_Calendar_FreeBusyRequest();
$freebusy_req->setTimeMin(date(DateTime::ATOM, strtotime('2020-01-01T08:00:00.000Z')));
$freebusy_req->setTimeMax(date(DateTime::ATOM, strtotime('2020-01-31T17:00:00.000Z')));
$freebusy_req->setTimeZone($timezone);
$freebusy_req->setCalendarExpansionMax(10);
$freebusy_req->setGroupExpansionMax(10);
//$item='';
$fnlItems=[];
for ($i=0; $i < count($items_arr); $i++) {
$item = new Google_Service_Calendar_FreeBusyRequestItem();
$item->setId($items_arr[$i]);
array_push($fnlItems, $item);
}
$freebusy_req->setItems($fnlItems);
$results = $service->freebusy->query($freebusy_req);
// $response = $sqladmin->instances
// ->listInstances('meeting-room-app-265703')->getItems();
print_r($results); die;
Ниже приведен результат:
Google_Service_Calendar_FreeBusyResponse Object
(
[calendarsType:protected] => Google_Service_Calendar_FreeBusyCalendar
[calendarsDataType:protected] => map`enter code here`
[groupsType:protected] => Google_Service_Calendar_FreeBusyGroup
[groupsDataType:protected] => map
[kind] => calendar#freeBusy
[timeMax] => 2020-01-31T18:29:59.000Z
[timeMin] => 2019-01-01T18:30:00.000Z
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
[calendars] => Array
(
[xxxxx.com_188dql9c1ap8ssdqhvdfdsds1gb7ddr55aufhr726gb@resource.calendar.google.com] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => global
[reason] => notFound
)
)
[busy] => Array
(
)
)
Подробнее здесь: [url]https://stackoverflow.com/questions/59853244/google-service-calendar-freebusyresponse-object[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия