Google Calendar API V3 how do I add an attendee to a list of existing attendees?

跟風遠走 提交于 2020-01-06 01:55:31

问题


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:


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? ;)



来源:https://stackoverflow.com/questions/26049259/google-calendar-api-v3-how-do-i-add-an-attendee-to-a-list-of-existing-attendees

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!