Google Calendar API V3 how do I add an attendee to

2019-08-15 19:02发布

I already have an $event->attendees with some existing attendees. I would like to add new EventAttendee to this event but it looks like my code crushes the old attendees list.

I try

$attendeesx= $event->getAttendees();
$attendees = array_push($attendeesx,$newattendee);
$event->attendees = $attendees;
$service->events->update(MyCalendar, $event->getID(), $event);

not working. Anyway I would like to add, not replace the old list by a new one. Any clue?

What is additionalGuest? What is it made for?

1条回答
贪生不怕死
2楼-- · 2019-08-15 19:41

array_push($attendeesx,$newattendee) modifies the $attendeesx in place. Than means the return value (which is an int) really should not be assigned to $attendees.

Also event has a setter for attendees, why not use that? ;)

查看更多
登录 后发表回答