I have a question about the Google Calendar API.
I php Google Calendar API and used my service account to write my schedule.
If you read the calendar with the same calendar ID again, you will not be able to read only the schedule that you wrote from php in your service account.
What are the possible causes?
Or is the schedule written from php in the service account a specification that php cannot read?
Configuration Information
①I am using the Google-api-php-client-1-master autoload.php.
②This is Google Calendar V3.
③The calendar ID gives the shared email account (service account) the permission to change the schedule and can be written to the calendar.
④You can read plans written directly by the owner on Google Calendar in php, but you cannot read plans written in php in your service account.
In short, it's a phenomenon where you can't read only what's written in php, write in php, and then reload.
Also, when I open Google Calendar, the schedule I wrote from php is well written.
However, the creator of the schedule was created with the address of the service account, not the owner's email account.
Does anyone know?
****Additional ****
//read EVENT
$json_path='../json/XXXX-123465789.json';
$json_string = file_get_contents($json_path, true);
$json=json_decode($json_string, true);
$private_key="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADAN...";
$client_email="[email protected]";
$scopes=array(Google_Service_Calendar::CALENDAR);
$credentials = new Google_Auth_AssertionCredentials(
$client_email,
$scopes,
$private_key
);
$client=newGoogle_Client();
$client->setApplicationName("Google Calendar PHP API");
$client->setAssertionCredentials ($credentials);
if($client->getAuth()->isAccessTokenExpired()){
$client->getAuth()->refreshTokenWithAssertion();
}
$service=newGoogle_Service_Calendar($client);
$read_start = mktime(0,0,0,4,10,2017);
$read_end = mktime(0,0,0,4,17,2017);
$calendarId='[email protected]';
$optParams=array(
'maxResults' = > 99,
'orderBy' = > 'startTime',
'singleEvents' = > TRUE,
'timeMin' = > date('c', $read_start),
'timeMax' = > date('c', $read_end),
);
$results=$service->events->listEvents($calendarId,$optParams);
// create EVENT
$json_path='./json/xxx-123456789.json';
$json_string = file_get_contents($json_path, true);
$json=json_decode($json_string, true);
$calendarId='[email protected]';
$private_key=$json['private_key'];
$client_email = $json ['client_email'];
$scopes=array(Google_Service_Calendar::CALENDAR);
$credentials = new Google_Auth_AssertionCredentials(
$client_email,
$scopes,
$private_key
);
$client=newGoogle_Client();
$client->setApplicationName("Google Calendar");
$client->setAssertionCredentials ($credentials);
if($client->getAuth()->isAccessTokenExpired()){
$client->getAuth()->refreshTokenWithAssertion();
}
$service=newGoogle_Service_Calendar($client);
$meeting_end_time =_get_sum_time($set_time, $meeting_time);
$event=newGoogle_Service_Calendar_Event(array(
'summary' = > 'created by service account',
'start' = > array(
'dateTime' = > '2017-04-04T00:12:00 + 09:00',
'timeZone' = > 'Asia/Tokyo',
),
'end' = > array(
'dateTime' = > '2017-04-04T00:13:00 + 09:00',
'timeZone' = > 'Asia/Tokyo',
),
));
$event=$service->events->insert($calendarId,$event);
Thank you for your cooperation.
google-api
I had the same problem.You can now get the recurring event by setting the parameter to true.
595 GDB gets version error when attempting to debug with the Presense SDK (IDE)
566 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
877 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.