编程语言
首页 > 编程语言> > PHPEWS在公共日历上创建事件

PHPEWS在公共日历上创建事件

作者:互联网

我正在尝试将基于php的日历管理系统插入Exchange 2007日历.

我目前有以下代码设置.

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

这样就可以在用户的​​个人日历中设置一个事件,但是我需要做的是将其发布到我具有folderID的公用文件夹日历中.

如果有人可以提供帮助,将不胜感激!

解决方法:

尝试添加以下行:

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

之后
            $request = new EWSType_CreateItemType();

其中$folder_id是您愚蠢的长Microsoft文件夹ID!

标签:exchangewebservices,php-ews,php
来源: https://codeday.me/bug/20191120/2043320.html