Garethp / php-ews

PHP Exchange Web Services
BSD 3-Clause "New" or "Revised" License
112 stars 46 forks source link

checkingIfUsersAreFree.php errors, everything returns false? #93

Closed robp2175 closed 5 years ago

robp2175 commented 7 years ago

I might not even be using this correctly, I am still learning to use this, but I am trying this new api, thank you for your efforts, and I am not retring anything but false. Plus I am getting the errors below.

As always, I appreciate any pointers. Thank you.

$cal = "room@domain.edu";
require_once 'vendor/autoload.php';

use garethp\ews\API;
use garethp\ews\API\Enumeration;
use garethp\ews\API\Type;

$api = API::withUsernameAndPassword('emsrv-exch.domaine.edu', 'admin', 'pass', ['timezone' => 'UTC'],['impersonation' => $cal]  
);

$calendar = $api->getCalendar();

$available = $calendar->areAvailable('11AM', '12PM', 30, [$cal]);
echo "<pre>";
var_dump($available);
echo "</pre>";
exit;
PHP Warning:  array_map(): Argument #2 should be an array in /var/www/html/glpimaintenance/form/vendor/garethp/php-ews/src/CalendarAPI.php on line 310
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/glpimaintenance/form/vendor/garethp/php-ews/src/CalendarAPI.php on line 312
<pre>bool(false)
</pre>
Garethp commented 5 years ago

Sorry for the late reply. It looks like the issue is that it's unable to resolve the email address you passed in.

Garethp commented 5 years ago

There's now a check for an error and it'll throw a useful exception message that actually tells you what's wrong