首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用php-ews将约会添加到Exchange 2007

使用php-ews将约会添加到Exchange 2007
EN

Stack Overflow用户
提问于 2011-08-01 22:16:21
回答 1查看 3.6K关注 0票数 1

有人有使用php-ews的经验吗?我想通过php-ews将新约会添加到Exchange2007日历中,但我不确定如何添加。php-ews的文档非常有限。以前有没有人这样做过,并愿意提供和举例?谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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对象

代码语言:javascript
复制
$ews = new ExchangeWebServices(
'server address',
'username@address',
'password'
);

在此基础上,您可以通过在PHP中构造一个" request“对象来构造SOAP XML请求,其中对象的属性是SOAP请求的层。

代码语言:javascript
复制
    $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;

然后将请求发送到服务器:

代码语言:javascript
复制
    $response = $ews->CreateItem($request);

var_dump-ing将为您提供服务器响应,并让您很好地了解$response是如何工作的。

至于只有很少的文档,Microsoft文档将告诉您XML请求是如何设置的(即,为哪些对象赋予哪些属性),以及您可以在XML请求上调用哪些方法:Operations" and "XML Elements

希望这能有所帮助!如果你有任何问题,请告诉我。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6899748

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档