0

How fetch google calendar resource using php-client I found same question here , I did not get any help from answer.

Can there is get all resource from google calendar of my company using download google admin sdk PHP

I could not get any sample or method into this lib how to get all resources like rooms. There is any way to fetch resource from company google calendar.

Community
  • 1
  • 1
Vipin Sharma
  • 421
  • 5
  • 24

1 Answers1

1

Here is solution

$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->setScopes(['https://www.googleapis.com/auth/admin.directory.resource.calendar','https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly']);
$client->setSubject('user@domain.com');
$directoryService = new \Google_Service_Directory($client);

$resources = $directoryService->resources_calendars->listResourcesCalendars('my_customer')->getItems();

var_dump($resources);
Vipin Sharma
  • 421
  • 5
  • 24