Php ews版本错误


Php ews Wrong Version

Im使用https://github.com/jamesiarmes/php-ews/wiki.如果我运行这个脚本,我总是在浏览器中收到一条错误消息。上面写着

未收集异常:版本错误

有人知道该怎么办吗?(我用config.inc include加载自动加载器,它可以工作)

Exchange版本2010 SP1

    #include("../include/all_inc.inc");
    $server = "******";
    $username="******";
    $password="*****";
    $version =ExchangeWebServices::VERSION_2010;
    $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);
    ?>

应该使用Exchange 2010 SP1的显式版本常量。

这应该为你做:

$version = ExchangeWebServices::VERSION_2010_SP1;