jamesiarmes/php-ews

Getting Ms Exchange server version using php-ews

pavan-bandodekar opened this issue · 0 comments

Version: 1.0.0
PHP version: 7.0.15
Microsoft Exchange version: Multiple

Description of problem:
I am using php-ews library(new library) to display the calendar events of the users in my project. The users can set their ms exchange account details in their profile and then use the calendar within my project itself. The code is like below

Request:

$host = '{host_set_on_users_profile}';
$username = '{username_set_on_users_profile}';
$password = '{password_set_on_users_profile}';
$version = Client::VERSION_2016;

$client = new Client($host, $username, $password, $version);
$client->setTimezone($timezone);

// Build request
$request = new FindItemType();
// more request building code here

$response = $client->FindItem($request);

Response: I am getting below issue

[faultstring] => The specified server version is invalid.

Additional details:
The reason is I have used fixed VERSION_2016 in code and the users can have any version of ms exchange set up for the account.

So is there any way using which first I can find out the server version based on host, username and password? so that I can use the same for creating the client object