【问题标题】:create event on selected google calendar on same account在同一帐户上的选定谷歌日历上创建活动
【发布时间】:2017-07-29 23:38:24
【问题描述】:

我有一个 Google 帐户,并且我的日历列表中有三个 Google 日历。我正在尝试使用选定的 Google 日历创建活动。我正在使用 php。

here is list of google calendars.
+----------------------+-----------------------------------------------+
| calName              | calid                                         |
+----------------------+-----------------------------------------------+
| harish@gmail.com     | harish@gmail.com                          |
| Contacts             | #contacts@group.v.calendar.google.com         |
| Holidays in India    | en.indian#holiday@group.v.calendar.google.com |
+----------------------+-----------------------------------------------+

harish@gmail.com 是一个“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#holiday@group.v.calendar.google.com'; // this is static for now

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

错误:


致命错误:在 /var/www/myinvitebig.com/vendor/google/ 中出现消息“调用 POST https://www.googleapis.com/calendar/v3/calendars/en.indian%23holiday%40group.v.calendar.google.com/events 时出错:(403) Forbidden”的未捕获异常“Google_Service_Exception” apiclient/src/Google /Http/REST.php:110 堆栈跟踪: #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 [内部函数]: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 在 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php 110 行

【问题讨论】:

    标签: php google-api google-calendar-api google-oauth google-api-php-client


    【解决方案1】:

    'en.indian#holiday@group.v.calendar.google.com'

    是在2014 中推出到 Google 日历的众多假日日历之一。这些是 Google 日历中的公共日历,任何人都可以订阅它们。但是,仅仅因为您订阅了所述日历并不意味着您拥有对它的写入权限。对于假期日历,您具有只读访问权限。

    (403) 禁止

    意味着您无权执行您正在尝试执行的操作。在这种情况下,将事件添加到您个人无权写入的日历中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-07
      • 2015-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-03
      • 1970-01-01
      相关资源
      最近更新 更多