WsdlToPhp /
PackageEws365
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Composer autoload |
||
| 4 | */ |
||
| 5 | require_once __DIR__ . '/../../vendor/autoload.php'; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Used classes |
||
| 9 | */ |
||
| 10 | use WsdlToPhp\PackageBase\AbstractSoapClientBase; |
||
| 11 | use Ews\EnumType\EwsExchangeVersionType; |
||
|
0 ignored issues
–
show
|
|||
| 12 | use Ews\EwsClassMap; |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
EwsClassMap. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
The type
Ews\EwsClassMap was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use Ews\StructType\EwsGetItemType; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsGetItemType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | use Ews\StructType\EwsItemResponseShapeType; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsItemResponseShapeType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use Ews\EnumType\EwsDefaultShapeNamesType; |
||
|
0 ignored issues
–
show
The type
Ews\EnumType\EwsDefaultShapeNamesType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | use Ews\StructType\EwsRequestServerVersion; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsRequestServerVersion was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 17 | use Ews\EnumType\EwsBodyTypeResponseType; |
||
|
0 ignored issues
–
show
The type
Ews\EnumType\EwsBodyTypeResponseType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | use Ews\StructType\EwsNonEmptyArrayOfBaseItemIdsType; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsNonEmptyArrayOfBaseItemIdsType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 19 | use Ews\StructType\EwsItemIdType; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsItemIdType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | use Ews\StructType\EwsMessageType; |
||
|
0 ignored issues
–
show
The type
Ews\StructType\EwsMessageType was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 21 | |||
| 22 | /** |
||
| 23 | * Your Office 365 login |
||
| 24 | */ |
||
| 25 | define('EWS_WS_LOGIN', '***************************'); |
||
| 26 | /** |
||
| 27 | * Your Office 365 passowrd |
||
| 28 | */ |
||
| 29 | define('EWS_WS_PASSWORD', '*************'); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Minimal options in order to instanciate the ServiceType named Get |
||
| 33 | */ |
||
| 34 | $options = array( |
||
| 35 | AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../../wsdl/services.updated.wsdl', |
||
| 36 | AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(), |
||
| 37 | AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN, |
||
| 38 | AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD, |
||
| 39 | ); |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Instanciation of the ServiceType get that gather all the operations beginnig with "get". |
||
| 43 | */ |
||
| 44 | $get = new \Ews\ServiceType\EwsGet($options); |
||
|
0 ignored issues
–
show
The type
Ews\ServiceType\EwsGet was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 45 | $get->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx'); |
||
| 46 | /** |
||
| 47 | * Configure the SoapHeader, each header's method begins with "setSoapHeader". |
||
| 48 | */ |
||
| 49 | $get->setSoapHeaderRequestServerVersion(new EwsRequestServerVersion(EwsExchangeVersionType::VALUE_EXCHANGE_2013_SP_1)); |
||
| 50 | /** |
||
| 51 | * Send the request with your actual ID |
||
| 52 | * inbox item id : AQMkADdmZTc2Y2EwLWM4QtNGNkYi1iOTZhLTI4ZTIzNjEwZGIzZgBGAAAD4a54IMUm0UC0Oie/nN4R4AcAHM3Rq81r8UGBMGXZ2QDPNOoAAAIBDAAAADSezQdp0a5Anuxdk9hQzRAAAAIFUQAAAA== |
||
| 53 | * calendar item id : AAMkADdmZTc2Y2EwL4YmQtNGNkYi1iOTZhLTI4ZTIzNjEwZGIzZgBGAAAAAADhrnggxSbRQLQ6J7+c3hHgBwAczdGrzWvxQYEwZdnZzzTqAAAAAAENAAA0ns0HadGuQJ7sXZPYUM0QAAAVnj3eAAA= |
||
| 54 | * taks item id : AAMkADdmZTc2Y2EwLWM4YtNGNkYi1iOTZhLTI4ZTIzNjEwZGIzZgBGAAAAAADhrnggxSbRQLQ6J7+c3hHgBwAczdGrzWvxQYEwZdnZzzTqAAAAAAESAAA0ns0HadGuQJ7sXZPYUM0QAAAVnkW1AAA= |
||
| 55 | * contac titme id : AAMkADdmZTc2Y2EwLWYmQtNGNkYi1iOTZhLTI4ZTIzNjEwZGIzZgBGAAAAAADhrnggxSbRQLQ6J7+c3hHgBwAczdGrzWvxQYEwZdnZzzTqAAAAAAEOAAA0ns0HadGuQJ7sXZPYUM0QAAAVnjYCAAA= |
||
| 56 | */ |
||
| 57 | $itemType = new EwsGetItemType(); |
||
| 58 | $shapeType = new EwsItemResponseShapeType(); |
||
| 59 | $shapeType |
||
| 60 | ->setBaseShape(EwsDefaultShapeNamesType::VALUE_ALL_PROPERTIES) |
||
| 61 | ->setBodyType(EwsBodyTypeResponseType::VALUE_BEST); |
||
| 62 | $itemType |
||
| 63 | ->setItemShape($shapeType) |
||
| 64 | ->setItemIds( |
||
| 65 | new EwsNonEmptyArrayOfBaseItemIdsType( |
||
| 66 | new EwsItemIdType('******************************************************************************************************************************************************') |
||
| 67 | ) |
||
| 68 | ); |
||
| 69 | $result = $get->GetItem($itemType); |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Debug informations provided by the utility methods |
||
| 73 | */ |
||
| 74 | if (false) { |
||
| 75 | echo 'XML Request: ' . $get->getLastRequest() . "\r\n"; |
||
| 76 | echo 'Headers Request: ' . $get->getLastRequestHeaders() . "\r\n"; |
||
| 77 | echo 'XML Response: ' . $get->getLastResponse() . "\r\n"; |
||
| 78 | echo 'Headers Response: ' . $get->getLastResponseHeaders() . "\r\n"; |
||
| 79 | } |
||
| 80 | |||
| 81 | if ($result !== false) { |
||
| 82 | /** |
||
| 83 | * Display the item data depending on its type: |
||
| 84 | */ |
||
| 85 | foreach($result->getResponseMessages()->getGetItemResponseMessage() as $message) { |
||
| 86 | /** |
||
| 87 | * In case of an Inbox Item |
||
| 88 | */ |
||
| 89 | if (is_array($message->getItems()->getMessage())) { |
||
| 90 | foreach($message->getItems()->getMessage() as $item) { |
||
| 91 | if ($item instanceof EwsMessageType) { |
||
| 92 | echo PHP_EOL . sprintf('Email sent by "%s <%s>" with subject "%s" sent at "%s" received at "%s"', |
||
| 93 | $item->getSender()->getMailbox()->getName(), |
||
| 94 | $item->getSender()->getMailbox()->getEmailAddress(), |
||
| 95 | $item->getSubject(), |
||
| 96 | $item->getDateTimeSent(), |
||
| 97 | $item->getDateTimeReceived()); |
||
| 98 | } |
||
| 99 | } |
||
| 100 | } |
||
| 101 | echo PHP_EOL; |
||
| 102 | } |
||
| 103 | } else { |
||
| 104 | /** |
||
| 105 | * In this case, we get the \SoapFault object |
||
| 106 | */ |
||
| 107 | print_r($get->getLastErrorForMethod('\Ews\ServiceType\EwsGet::GetItem')); |
||
| 108 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths