3

我正在尝试将基于 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 的公用文件夹日历。

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

4

2 回答 2

2

尝试添加该行:

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

在 $request = new EWSType_CreateItemType() 之后;

$folder_id 是你愚蠢的长微软文件夹 id!!!!

于 2015-05-12T17:46:01.323 回答
1

我现在也在做同样的事情。

您必须将 SEND_ONLY_TO_ALL 替换为 SEND_TO_NONE。

这意味着我们无法为存储在公用文件夹中的约会发送会议邀请(几周以来,我一直在努力寻找解决此问题的方法)。

我不确定您的请求中是否还有其他问题,但这肯定是个问题。

于 2015-05-15T12:36:25.273 回答