I've been using php-ews for a month, i able to make a meeting but i want the organizer is the room email / room name that i attend the meeting
so for example, i create a meeting at 8:00am - 10:00am at room1 ([email protected]), i want the organizer is the room email ([email protected]) / room name (room1)
i know i can do this in the office 365 (login with my credential ->choose open another mailbox -> choose [email protected]), but i want to do this via php-ews
i already set the resource mailbox, mailbox delegation property to my login credential
is it possible to change the organizer name to room name / room email??
my basic code:
$host = $selected_exchange->exchange_host;
$username = $exchange_email;
$password = $exchange_password;
$version = $selected_exchange->exchange_version;
$timezone = 'SE Asia Standard Time';
$client = new Client($host, $username, $password, $version);
$client->setTimezone($timezone);
$start = new DateTime($booking_date . $booking_time_start . ":00");
$end = new DateTime($booking_date . $booking_time_end);
$guests = array(
array(
'name' => $room->exchange_room_name,
'email' => $room->exchange_room_email,
)
);
// Set connection information.
$request = new CreateItemType();
$request->SendMeetingInvitations = 'SendOnlyToAll';
//CalendarItemCreateOrDeleteOperationType::SEND_ONLY_TO_ALL;
$request->Items = new NonEmptyArrayOfAllItemsType();
// Build the event to be added.
$event = new CalendarItemType();
$event->RequiredAttendees = new NonEmptyArrayOfAttendeesType();
$event->Start = $start->format('c');
$event->End = $end->format('c');
$event->Subject = $meeting_title;
$event->Location = $room->exchange_room_name;
// Set the event body.
$event->Body = new BodyType();
$event->Body->_ = $special_request . " Meeting Created By: ";
$event->Body->BodyType = 'Text'; //BodyTypeType::TEXT;
// Iterate over the guests, adding each as an attendee to the request.
foreach ($guests as $guest) {
$attendee = new AttendeeType();
$attendee->Mailbox = new EmailAddressType();
$attendee->Mailbox->EmailAddress = $guest['email'];
$attendee->Mailbox->Name = $guest['name'];
$attendee->Mailbox->RoutingType = 'SMTP'; //RoutingType::SMTP;
$event->RequiredAttendees->Attendee[] = $attendee;
}
try
{
// Add the event to the request. You could add multiple events to create more
// than one in a single request.
$request->Items->CalendarItem[] = $event;
$response = $client->CreateItem($request);
// Iterate over the results, printing any error messages or event ids.
$response_messages = $response->ResponseMessages->CreateItemResponseMessage;
foreach ($response_messages as $response_message) {
// Make sure the request succeeded.
if ($response_message->ResponseClass != ResponseClassType::SUCCESS) {
$code = $response_message->ResponseCode;
$message = $response_message->MessageText;
//fwrite(STDERR, "Event failed to create with \"$code: $message\"\n");
$result = array('ok' => 0, 'message' => $message);
continue;
}
// Iterate over the created events, printing the id for each.
foreach ($response_message->Items->CalendarItem as $item) {
$id = $item->ItemId->Id;
//fwrite(STDOUT, "Created event $id\n");
$result = array('ok' => 1, 'message' => 'Success Added To Calendar');
}
}
}
catch(Exception $e)
{
$result = array('ok' => 0, 'message' => $message);
}