【问题标题】:Not collected Exception: Wrong Version PHP-EWS未收集异常:PHP-EWS 版本错误
【发布时间】:2015-05-27 10:35:24
【问题描述】:

我正在尝试连接 PHP-EWS 和我的 Exchange 服务器。 我使用来自https://github.com/jamesiarmes/php-ews/wiki的脚本

但每次我加载脚本时浏览器都会告诉我

未收集异常:版本错误

这是我的脚本(自动加载器在一个额外的文件中,所以不用担心它可以工作)

$server = "***********";
$username="***********";
$password="*******";
$version= "2010"; // or Exchange 2010; Exchange 2010 SP1

$ews = new ExchangeWebServices($server, $username, $password, $version);


$request = new EWSType_FindFolderType();
$request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;
$request->FolderShape = new EWSType_FolderResponseShapeType();
$request->FolderShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;

// configure the view
$request->IndexedPageFolderView = new EWSType_IndexedPageViewType();
$request->IndexedPageFolderView->BasePoint = 'Beginning';
$request->IndexedPageFolderView->Offset = 0;

// set the starting folder as the inbox
$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;

// make the actual call
$response = $ews->FindFolder($request);

?>

有没有人知道为什么我一直在得到

未收集异常:版本错误

知道该怎么做吗?

【问题讨论】:

    标签: php github exchange-server php-ews


    【解决方案1】:

    您的版本错误,您应该使用 ExchangeWebServices 中的预定义常量之一。 例如:$version = ExchangeWebServices::VERSION_2010 您应该查看“ExchangeWebServices.php”以了解定义了哪些其他版本。

    【讨论】:

    • 如果现在尝试“const VERSION_2010_SP1; Exchange2010_SP1; ExchangeWebServices::VERSION_2010; ExchangeWebServices::VERSION_2010_SP1; Exchange2010_SP1。”但这些都不起作用....
    • 我不太明白你的尝试,你用我的例子了吗?您的 Exchange 服务器实际上是 2010 年或更高版本吗?
    • 起初我尝试了你的例子。但它没有用..同样的错误信息。然后我查找了 ExchangeWebServices.php 并尝试了我在“”中写的所有内容。我的交换服务器是 2010 SP1
    • 默认使用exchange 2007,尽量不发送版本参数,至少应该解决这个问题。您可能会遗漏一些仅在 2010 年才存在的功能,但您可以稍后处理。
    • 唯一需要检查的就是验证 Exchange 服务器本身是否启用了 EWS
    猜你喜欢
    • 1970-01-01
    • 2016-08-24
    • 1970-01-01
    • 1970-01-01
    • 2011-09-04
    • 2013-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多