我试图将基于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);
这将在用户个人日历中设置一个事件就好了,但我需要做的是将它发布到我有文件夹ID的公共文件夹日历。
如果有人可以提供帮助,我们将不胜感激!
答案 0 :(得分:2)
尝试添加以下行:
$request->SavedItemFolderId->FolderId->Id=$folder_id;
之后
$ request = new EWSType_CreateItemType();
其中$ folder_id是你愚蠢的微软文件夹ID !!!!
答案 1 :(得分:1)
我现在正在做同样的事。
您必须将SEND_ONLY_TO_ALL替换为SEND_TO_NONE。
这意味着我们无法发送存储在公用文件夹中的约会的会议邀请(我已经尝试在几周内找到解决此问题的方法)。
我不确定您的请求中是否还有其他问题,但这肯定是个问题。