如何从PHP连接到Exchange Online API

时间:2013-02-18 13:57:55

标签: php exchangewebservices

我手边有一项任务,要求我连接Exchange Online帐户并列出PHP中的所有日历条目。

我已阅读了许多Microsoft帮助文档,但它都是指c#代码。有人可以指导我完成使用PHP实现这一目标的步骤。

1 个答案:

答案 0 :(得分:14)

试试这个:

$ews = new ExchangeWebServices($host, $username, $password);

$request = new EWSType_FindItemType();
$request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;

$request->ItemShape = new EWSType_ItemResponseShapeType();
$request->ItemShape->BaseShape =
        EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;

$request->CalendarView = new EWSType_CalendarViewType();
$request->CalendarView->StartDate = date('c', strtotime('01/01/2011 -00'));
$request->CalendarView->EndDate = date('c', strtotime('01/31/2011 -00'));

$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId =
        new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id =
        EWSType_DistinguishedFolderIdNameType::CALENDAR;

这样:https://github.com/jamesiarmes/php-ews