发送谷歌日历API确认邮件

问题描述 投票:0回答:1

我试图让它成为一个事件创建与谷歌日历API和与会者被添加,他们将收到一封确认电子邮件。

这在当前的Google Calendar API中可以实现吗?(我使用PHP做后端)。我已经尝试过 sendUpdates 设置为全部和 attendees[].responseStatusneedsAction 但没有成功。

$event = new Google_Service_Calendar_Event(array(
  'summary' =>'something',
  'location' => 'something',
  'description' => $name.' test',
  'start' => array(
    // 'dateTime' => '2015-05-28T09:00:00-07:00',
    'dateTime' => $start.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'end' => array(
    'dateTime' => $end.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'attendees' => array(
    array('email' => $email),
    'responseStatus' => 'needsAction',
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
  'sendUpdates' => 'all',
  'visibility' => 'public',
));

$calendarId = '[email protected]';
$event = $service->events->insert($calendarId, $event);
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>"; 

预先谢谢你

php google-calendar-api
1个回答
2
投票

sendUpdates 是一个请求参数,而不是请求主体的一个选项。

换句话说,它不在请求体中。

修改你的代码如下。

$event = new Google_Service_Calendar_Event(array(
  'summary' =>'something',
  'location' => 'something',
  'description' => $name.' test',
  'start' => array(
    // 'dateTime' => '2015-05-28T09:00:00-07:00',
    'dateTime' => $start.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'end' => array(
    'dateTime' => $end.':00-04:00',
    'timeZone' => 'America/Toronto',
  ),
  'attendees' => array(
    array('email' => $email),
    'responseStatus' => 'needsAction',
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
  'visibility' => 'public',
));

$calendarId = '[email protected]';
$event = $service->events->insert($calendarId, $event, array('sendUpdates' => 'all'));
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>"; 
© www.soinside.com 2019 - 2024. All rights reserved.