public function testWithUsernameAndPassword() { //Create our expected item, get our class to build our item, then compare $expected = ExchangeWebServices::fromUsernameAndPassword('test.com', 'username', 'password', ['version' => ExchangeWebServices::VERSION_2010]); $client = API::withUsernameAndPassword('test.com', 'username', 'password'); $actual = $client->getClient(); $this->assertEquals($expected, $actual); }
<?php use jamesiarmes\PEWS\API\Type\ConnectingSIDType; use jamesiarmes\PEWS\API\Type\ExchangeImpersonation; //Impersonate an email address $api = \jamesiarmes\PEWS\API::withUsernameAndPassword('server', 'username', 'password', ['impersonation' => '*****@*****.**']); //Build your own impersonation $connectingSID = new ConnectingSIDType(); $connectingSID->setPrincipalName('Some Name'); $connectingSID->setPrimarySmtpAddress('*****@*****.**'); $impersonation = new ExchangeImpersonation(); $impersonation->setConnectingSID($connectingSID); $api = \jamesiarmes\PEWS\API::withUsernameAndPassword('server', 'username', 'password', ['impersonation' => $impersonation]);
<?php use jamesiarmes\PEWS\API; $api = API::withUsernameAndPassword('server', 'username', 'password'); $calendar = $api->getCalendar(); //Delete One Item $item = $calendar->getCalendarItems()[0]; $calendar->deleteCalendarItem($item->getItemId()); //Delete all items between two date ranges $calendar->deleteAllCalendarItems(new DateTime('8:00 AM'), new DateTime('5:00 PM'));
<?php require_once "vendor/autoload.php"; use jamesiarmes\PEWS\API\Type; use jamesiarmes\PEWS\API\Type\CalendarItem; use jamesiarmes\PEWS\Caster; use jamesiarmes\PEWS\Test\API\TypeTest; use jamesiarmes\PEWS\Calendar\CalendarAPI; $api = \jamesiarmes\PEWS\API::withUsernameAndPassword('server', 'username', 'password', ['primarySmtpEmailAddress' => '*****@*****.**']); $api->getFolderByDistinguishedId('inbox');