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 7 months ago • 0 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