Skip to content

Commit

Permalink
improve documentation and samples
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Mar 23, 2017
1 parent da2e0a5 commit 4d1a151
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 19 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ $ composer update
## Learn from the tutorial
Start looking into the auto-generated [tutorial.php](tutorial.php) file. This file contains the starting code to use this package. In addition it contains all the operations provided by the Exchange Web Services and the way to call them.

## Determine your Office 365 endpoint action location
Determining the Office 365 endpoint action location can be tricky so below is indicated 2 ways to do it. This location must be defined in the `setLocation` call into the sample files.
The default location has been defined so it might work fine with you too. If not, you should try determining it. If you don't understand, don't hesitate to contact me at [email protected].

### Manually from the endpoint itself
You should be able to get the endpoint action location from the services.wsdl by opening your browser and browsing to [outlook.office365.com/EWS/Exchange.asmx](https://outlook.office365.com/EWS/Exchange.asmx).
You must enter your Office 365 credentials then it should display a page where it indicates something such as `svcutil.exe https://**.outlook.com/EWS/Services.wsdl`.
This is in the `https://**.outlook.com/EWS/Services.wsdl` that you can find at the end the endpoint action location such as `<soap:address location="**https://outlook.office365.com/EWS/Exchange.asmx**" />`.

### From your Office 365 account
Following this [Tech Blog article](http://blog.skysoft-is.com/?p=78), I simply used the endpoint location action indicated in the article as https://pod51036.outlook.com/ews/services.wsdl and it worked :).

## Start from the samples
Sample scripts are available under the [samples](samples) folder:

Expand Down
2 changes: 1 addition & 1 deletion samples/GetServerTimeZones.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Ews\StructType\EwsGetServerTimeZonesType;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '');
/**
Expand Down
5 changes: 3 additions & 2 deletions samples/calendar/FindItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsRequestServerVersion;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$find = new \Ews\ServiceType\EwsFind($options);
$find->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
5 changes: 3 additions & 2 deletions samples/calendar/GetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsCalendarItemType;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$get = new \Ews\ServiceType\EwsGet($options);
$get->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
5 changes: 3 additions & 2 deletions samples/contact/FindItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsRequestServerVersion;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$find = new \Ews\ServiceType\EwsFind($options);
$find->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
5 changes: 3 additions & 2 deletions samples/contact/GetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsMessageType;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$get = new \Ews\ServiceType\EwsGet($options);
$get->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
5 changes: 3 additions & 2 deletions samples/inbox/FindItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsRequestServerVersion;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$find = new \Ews\ServiceType\EwsFind($options);
$find->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
3 changes: 2 additions & 1 deletion samples/inbox/FindUnreadItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use Ews\EnumType\EwsUnindexedFieldURIType;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -49,6 +49,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$find = new \Ews\ServiceType\EwsFind($options);
$find->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
5 changes: 3 additions & 2 deletions samples/inbox/GetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsContactItemType;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$get = new \Ews\ServiceType\EwsGet($options);
$get->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
2 changes: 1 addition & 1 deletion samples/task/CreateItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Ews\EwsClassMap;
use Ews\StructType\EwsBodyType;
/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand Down
5 changes: 3 additions & 2 deletions samples/task/FindItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsRequestServerVersion;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$find = new \Ews\ServiceType\EwsFind($options);
$find->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down
5 changes: 3 additions & 2 deletions samples/task/GetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Ews\StructType\EwsTaskType;

/**
* Your Office 365 login, like {id}@{id}.onmicrosoft.com
* Your Office 365 login
*/
define('EWS_WS_LOGIN', '***************************');
/**
Expand All @@ -32,7 +32,7 @@
* Minimal options in order to instanciate the ServiceType named Get
*/
$options = array(
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.wsdl',
AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl',
AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(),
AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN,
AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD,
Expand All @@ -42,6 +42,7 @@
* Instanciation of the ServiceType get that gather all the operations beginnig with "get".
*/
$get = new \Ews\ServiceType\EwsGet($options);
$get->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx');
/**
* Configure the SoapHeader, each header's method begins with "setSoapHeader".
*/
Expand Down

0 comments on commit 4d1a151

Please sign in to comment.