有人有使用php-ews的经验吗?我想通过php-ews将新约会添加到Exchange2007日历中,但我不确定如何添加。php-ews的文档非常有限。以前有没有人这样做过,并愿意提供和举例?谢谢
发布于 2011-08-10 08:27:26
呃。几周前我经历过这样的事情。这方面的文档很糟糕。如果有任何关于PHP和EWS的问题,请随时向我提问。
因此,假设您想要为某个用户的日历创建一个新的calendar事件,您需要从下载James Armes的Exchange Web服务客户端开始:http://code.google.com/p/php-ews/source/browse/
它是一系列的PHP类,使得通过PHP访问Exchange服务器变得很容易。
然后创建一个ExchangeWebServices对象
$ews = new ExchangeWebServices(
'server address',
'username@address',
'password'
);在此基础上,您可以通过在PHP中构造一个" request“对象来构造SOAP XML请求,其中对象的属性是SOAP请求的层。
$request->SendMeetingInvitations = 'SendToNone';
$request->SavedItemFolderId->DistinguishedFolderId->Id = 'calendar';
$request->Items->CalendarItem->Subject = 'this is the subject of the email';
$request->Items->CalendarItem->Start = date('c', strtotime('today'));
//making this an all day event for the heck of it
$request->Items->CalendarItem->End = date('c', strtotime('today + 1 day'));
$request->Items->CalendarItem->IsAllDayEvent = true;
$request->Items->CalendarItem->LegacyFreeBusyStatus = 'Free';
$request->Items->CalendarItem->Categories->String = $category;
$request->Items->CalendarItem->Body->BodyType = 'Text';
$request->Items->CalendarItem->Body->_ = $body;然后将请求发送到服务器:
$response = $ews->CreateItem($request);var_dump-ing将为您提供服务器响应,并让您很好地了解$response是如何工作的。
至于只有很少的文档,Microsoft文档将告诉您XML请求是如何设置的(即,为哪些对象赋予哪些属性),以及您可以在XML请求上调用哪些方法:Operations" and "XML Elements。
希望这能有所帮助!如果你有任何问题,请告诉我。
https://stackoverflow.com/questions/6899748
复制相似问题