PHPEWS creates event on public calendar

I am trying to connect a php based calendar management system to Exchange 2007 calendars.

I currently have a code setup.

$subject = 'Appointment with ..';

        $request = new EWSType_CreateItemType();
        $request->Items = new EWSType_NonEmptyArrayOfAllItemsType();
        $request->Items->CalendarItem = new EWSType_CalendarItemType();

        $request->Items->CalendarItem->Subject = $subject;

        $date1 = new DateTime('2015-05-10T15:00:00+03:00');
        $DateStart = $date1->format('Y-m-d H:i:00');
        $date = new DateTime($DateStart);
        $request->Items->CalendarItem->Start = $date->format('c');
        $date1 = new DateTime('2015-05-10T17:00:00+03:00');
        $DateEnd = $date1->format('Y-m-d H:i:00');
        $date = new DateTime($DateEnd);
        $request->Items->CalendarItem->End = $date->format('c');

        $request->Items->CalendarItem->ReminderIsSet = false;

        $request->Items->CalendarItem->ReminderMinutesBeforeStart = 15;

        $request->Items->CalendarItem->Body = new EWSType_BodyType();
        $request->Items->CalendarItem->Body->BodyType = EWSType_BodyTypeType::HTML;

$request->Items->CalendarItem->Body->_ = <<<EOD

    <p><strong>Staff Attending</strong>:bob</p>

EOD;

        $request->Items->CalendarItem->ItemClass = new EWSType_ItemClassType();
        $request->Items->CalendarItem->ItemClass->_ = EWSType_ItemClassType::APPOINTMENT;

        $request->Items->CalendarItem->Sensitivity = new EWSType_SensitivityChoicesType();
        $request->Items->CalendarItem->Sensitivity->_ = EWSType_SensitivityChoicesType::NORMAL;

        $request->Items->CalendarItem->Categories = new EWSType_ArrayOfStringsType();
        $request->Items->CalendarItem->Categories->String = array(
            'Client Meeting (Scheduled)'
        );

        $request->Items->CalendarItem->Location = "Showroom";

        $request->SendMeetingInvitations = EWSType_CalendarItemCreateOrDeleteOperationType::SEND_ONLY_TO_ALL;
        $request->Items->CalendarItem->RequiredAttendees->Attendee[0]->Mailbox->EmailAddress = "user@domain.com";
        $request->Items->CalendarItem->RequiredAttendees->Attendee[0]->Mailbox->RoutingType  = 'SMTP';
        $n = 1;


        $response      = $ews->CreateItem($request);

      

This will set up an event on the users' personal calendar just fine, but I need to do this in order to send it to the public folder calendar for which I have a folderID.

If anyone can help it would be very helpful!

+3


source to share


2 answers


Try adding the line:

        $request->SavedItemFolderId->FolderId->Id=$folder_id;

      



after $ request = new EWSType_CreateItemType ();

where $ folder_id is your silly long microsoft folder id !!!!

+1


source


I am doing the same now.

You must replace SEND_ONLY_TO_ALL with SEND_TO_NONE.



This means that we are unable to send meeting requests for appointments stored in a shared folder (I've been trying to find a workaround for this issue for a couple of weeks).

I'm not sure if there are other issues in your request, but this is definitely the problem.

0


source







All Articles