google-api-php-client icon indicating copy to clipboard operation
google-api-php-client copied to clipboard

Organizer is set to "join now" immediately but i have to set other selected attendees also "join now" immediately without asking "ask to join"

Open ArjunChaudhary01 opened this issue 1 year ago • 2 comments

        // Prepare attendees array
        $attendees = [];
        // Add organizer with 'responseStatus' set to 'accepted'
        $attendees[] = new \Google_Service_Calendar_EventAttendee([
            'email' => $user->email,
            'responseStatus' => 'accepted', // Organizer should join immediately
        ]);

        // Add selected attendees with 'responseStatus' set to 'accepted'
        foreach ($this->staff as $userId) {
            $attendeeUser = User::find($userId);
            if ($attendeeUser) {
                $attendees[] = new \Google_Service_Calendar_EventAttendee([
                    'email' => $attendeeUser->email,
                    'responseStatus' => 'accepted', // Selected attendees should join immediately  (this responsestatus not working)
                ]);
            }
        }
        // Create Event
        $event = new Calendar\Event([
            'summary' => $this->title,
            'start' => new Calendar\EventDateTime([
                'dateTime' => $startDateTime,
                'timeZone' => 'Asia/Tokyo',
            ]),
            'end' => new Calendar\EventDateTime([
                'dateTime' => $endDateTime,
                'timeZone' => 'Asia/Tokyo',
            ]),
            'attendees' =>  $attendees, // Add attendees
            'conferenceData' => new Calendar\ConferenceData([
                'createRequest' => new Calendar\CreateConferenceRequest([
                    'requestId' => uniqid(),
                    'conferenceSolutionKey' => new Calendar\ConferenceSolutionKey([
                        'type' => 'hangoutsMeet',
                    ]),
                ]),
            ]),
            'visibility' => 'public', // Make the event public
        ]);

please comment on this

ArjunChaudhary01 avatar Jul 04 '24 08:07 ArjunChaudhary01

There is a note in the API docs about setting responseStatus directly, I don't know if this might apply to you here...

Warning: If you add an event using the values declined, tentative, or accepted, attendees with the "Add invitations to my calendar" setting set to "When I respond to invitation in email" or "Only if the sender is known" might have their response reset to needsAction and won't see an event in their calendar unless they change their response in the event invitation email. Furthermore, if more than 200 guests are invited to the event, response status is not propagated to the guests.

sparksp avatar Nov 11 '24 13:11 sparksp

I have tried but does not worked.

ArjunChaudhary01 avatar Nov 12 '24 06:11 ArjunChaudhary01