1

Im trying to connect with the PHP-EWS and my Exchange server. I use the Script from https://github.com/jamesiarmes/php-ews/wiki

But everytime i load my script the browser tells me

Not collected Exception: Wrong Version

Here is my script (The Autoloader is in a extra File so dont worry it works)

$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);

?>

Does anybody know why i keep getting

Not collected Exception: Wrong Version

and knew what to do?

Xymz
  • 21
  • 5

1 Answers1

0

Your version is wrong, you should use one of the pre-defined constants in ExchangeWebServices. E.g: $version = ExchangeWebServices::VERSION_2010 You should have a look at "ExchangeWebServices.php" in order to see which other versions are defined.

in need of help
  • 1,606
  • 14
  • 27
  • If tried now "const VERSION_2010_SP1; Exchange2010_SP1; ExchangeWebServices::VERSION_2010; ExchangeWebServices::VERSION_2010_SP1; Exchange2010_SP1." But none of that worked.... – Xymz Mar 24 '15 at 09:34
  • I didn't really understand what you tried, did you use my example? Is your exchange server actually 2010 or above? – in need of help Mar 24 '15 at 09:35
  • At first i tried youre example. But it didnt worked.. Same error message. Then i looked up ExchangeWebServices.php and tried all what i wirte in the "". my exchange server is 2010 SP1 – Xymz Mar 24 '15 at 09:39
  • By default it will use exchange 2007, try not sending the version parameter at all, it should at least take care of that issue. You might be missing some functionality that exists only in 2010 but you can handle that later. – in need of help Mar 24 '15 at 09:54
  • The only thing left to check is to verify that EWS is enabled on the exchange server itself – in need of help Mar 24 '15 at 14:20
  • Sorry for the late answere. Yes it is enabled couse i can send with c# a email with the exchange Server. – Xymz Mar 30 '15 at 11:39