1

选择谷歌日历事件我有一个谷歌帐户,并有三个谷歌日历我的日历列表。我正在尝试使用选定的Google日历创建活动。我正在使用PHP。创建对同一账户

here is list of google calendars. 
+----------------------+-----------------------------------------------+ 
| calName    | calid           | 
+----------------------+-----------------------------------------------+ 
| [email protected]  | [email protected]       | 
| Contacts    | #[email protected]   | 
| Holidays in India | en.indian#[email protected] | 
+----------------------+-----------------------------------------------+ 

[email protected]是一个“primary”日历。当我在这个日历中创建一个事件时,事件使用PHP成功创建。

然而,当我尝试在“Contacts, Holidays in India”日历创建活动,它从来没有使用PHP为这些日历创建活动。

我的代码:

  $event = new Google_Service_Calendar_Event(array(
      'summary' => $eventname, 
      'location' => $address, 
      'description' => $description, 
      'start' => array(
       'dateTime' => $s, 
       'timeZone' => $timezone, 
      ), 
      'end' => array(
       'dateTime' => $e, 
       'timeZone' => $timezone, 
      ), 
      'attendees' => array(
       array('email' => $contactemail), 
      ), 
      'reminders' => array(
       'useDefault' => FALSE, 
       'overrides' => array(
       array('method' => 'email', 'minutes' => 24 * 60), 
       array('method' => 'popup', 'minutes' => 10), 
      ), 
      ), 
     )); 

$calid = 'en.indian#[email protected]'; // this is static for now 

     $event = $service->events->insert($calid, $event); 

错误:


Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling POST https://www.googleapis.com/calendar/v3/calendars/en.indian%23holiday%40group.v.calendar.google.com/events : (403) Forbidden' in /var/www/myinvitebig.com/vendor/google/apiclient/src/Google /Http/REST.php:110 Stack trace: #0 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php(62): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request), Object(Google_Client)) #1 [internal function]: Google_Http_REST::doExecute(Object(Google_Client), Object(Google_Http_Request)) #2 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Task/Runner.php(174): call_user_func_array(Array, Array) #3 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php(46): Google_Task_Runner->run() #4 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Client.php(593): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) #5 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Ser in /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php on line 110

回答

1

'en.indian#[email protected]'

那是是在2014推广到谷歌日历中的许多假日日历之一。这些都是Google日历中的公共日历,任何人都可以订阅它们。但是仅仅因为你已经订阅了日历说并不意味着你必须把它写访问。在假日日历的情况下,您只能读取访问权限。

(403) Forbidden

表示您没有权限执行您正在尝试执行的操作。在这种情况下添加一个事件日历,你不亲自有写入权限。

相关问题