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
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 ![]() 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.
![]() |
|||
13 | use Ews\StructType\EwsFindItemType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsFindItemType 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 ![]() |
|||
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 ![]() |
|||
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 ![]() |
|||
16 | use Ews\StructType\EwsNonEmptyArrayOfBaseFolderIdsType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsNonEmptyArrayOfBaseFolderIdsType 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 ![]() |
|||
17 | use Ews\EnumType\EwsDistinguishedFolderIdNameType; |
||
0 ignored issues
–
show
The type
Ews\EnumType\EwsDistinguishedFolderIdNameType 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 ![]() |
|||
18 | use Ews\EnumType\EwsItemQueryTraversalType; |
||
0 ignored issues
–
show
The type
Ews\EnumType\EwsItemQueryTraversalType 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 ![]() |
|||
19 | use Ews\StructType\EwsDistinguishedFolderIdType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsDistinguishedFolderIdType 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 ![]() |
|||
20 | 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 ![]() |
|||
21 | use Ews\StructType\EwsIsEqualToType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsIsEqualToType 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 ![]() |
|||
22 | use Ews\StructType\EwsFieldURIOrConstantType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsFieldURIOrConstantType 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 ![]() |
|||
23 | use Ews\StructType\EwsConstantValueType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsConstantValueType 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 ![]() |
|||
24 | use Ews\StructType\EwsRestrictionType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsRestrictionType 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 ![]() |
|||
25 | use Ews\StructType\EwsPathToUnindexedFieldType; |
||
0 ignored issues
–
show
The type
Ews\StructType\EwsPathToUnindexedFieldType 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 ![]() |
|||
26 | use Ews\EnumType\EwsUnindexedFieldURIType; |
||
0 ignored issues
–
show
The type
Ews\EnumType\EwsUnindexedFieldURIType 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 ![]() |
|||
27 | |||
28 | /** |
||
29 | * Your Office 365 login |
||
30 | */ |
||
31 | define('EWS_WS_LOGIN', '***************************'); |
||
32 | /** |
||
33 | * Your Office 365 passowrd |
||
34 | */ |
||
35 | define('EWS_WS_PASSWORD', '************'); |
||
36 | |||
37 | /** |
||
38 | * Minimal options in order to instanciate the ServiceType named Get |
||
39 | */ |
||
40 | $options = array( |
||
41 | AbstractSoapClientBase::WSDL_URL => __DIR__ . '/../wsdl/services.updated.wsdl', |
||
42 | AbstractSoapClientBase::WSDL_CLASSMAP => EwsClassMap::get(), |
||
43 | AbstractSoapClientBase::WSDL_LOGIN => EWS_WS_LOGIN, |
||
44 | AbstractSoapClientBase::WSDL_PASSWORD => EWS_WS_PASSWORD, |
||
45 | AbstractSoapClientBase::WSDL_CACHE_WSDL => WSDL_CACHE_NONE, |
||
46 | ); |
||
47 | |||
48 | /** |
||
49 | * Instanciation of the ServiceType get that gather all the operations beginnig with "get". |
||
50 | */ |
||
51 | $find = new \Ews\ServiceType\EwsFind($options); |
||
0 ignored issues
–
show
The type
Ews\ServiceType\EwsFind 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 ![]() |
|||
52 | $find->setLocation('https://pod51036.outlook.com/ews/Exchange.asmx'); |
||
53 | /** |
||
54 | * Configure the SoapHeader, each header's method begins with "setSoapHeader". |
||
55 | */ |
||
56 | $find->setSoapHeaderRequestServerVersion(new EwsRequestServerVersion(EwsExchangeVersionType::VALUE_EXCHANGE_2013_SP_1)); |
||
57 | /** |
||
58 | * Send the request |
||
59 | */ |
||
60 | $itemType = new EwsFindItemType(); |
||
61 | $itemShape = new EwsItemResponseShapeType(EwsDefaultShapeNamesType::VALUE_ALL_PROPERTIES); |
||
62 | $isEqualTo = new EwsIsEqualToType(); |
||
63 | $isEqualTo |
||
64 | ->setFieldURIOrConstant(new EwsFieldURIOrConstantType(new EwsConstantValueType('0'))) |
||
65 | ->setFieldURI(new EwsPathToUnindexedFieldType(EwsUnindexedFieldURIType::VALUE_MESSAGE_IS_READ)); |
||
66 | $restriction = new EwsRestrictionType(); |
||
67 | $restriction->setIsEqualTo($isEqualTo); |
||
68 | $itemType |
||
69 | ->setItemShape($itemShape) |
||
70 | ->setParentFolderIds(new EwsNonEmptyArrayOfBaseFolderIdsType(null, new EwsDistinguishedFolderIdType(EwsDistinguishedFolderIdNameType::VALUE_INBOX))) |
||
71 | ->setTraversal(EwsItemQueryTraversalType::VALUE_SHALLOW) |
||
72 | ->setRestriction($restriction); |
||
73 | $result = $find->FindItem($itemType); |
||
74 | |||
75 | /** |
||
76 | * Debug informations provided by the utility methods |
||
77 | */ |
||
78 | if (false) { |
||
79 | echo 'XML Request: ' . $find->getLastRequest() . "\r\n"; |
||
80 | echo 'Headers Request: ' . $find->getLastRequestHeaders() . "\r\n"; |
||
81 | echo 'XML Response: ' . $find->getLastResponse() . "\r\n"; |
||
82 | echo 'Headers Response: ' . $find->getLastResponseHeaders() . "\r\n"; |
||
83 | } |
||
84 | |||
85 | if ($result !== false) { |
||
86 | /** |
||
87 | * Display the Inbox items if there is at least one: |
||
88 | * |
||
89 | * Message from "{name} <{email}>" with subject "{subject}" sent at "2017-02-03T20:51:20Z" |
||
90 | * Message from "{name} <{email}>" with subject "{subject}" sent at "2017-02-02T17:48:25Z" |
||
91 | * ... etc |
||
92 | */ |
||
93 | foreach($result->getResponseMessages()->getFindItemResponseMessage() as $message) { |
||
94 | $messages = $message->getRootFolder()->getItems()->getMessage(); |
||
95 | if (is_array($messages)) { |
||
96 | foreach($messages as $item) { |
||
97 | echo PHP_EOL . sprintf('Message from "%s <%s>" with subject "%s" sent at "%s"', |
||
98 | $item->getFrom()->getMailbox()->getName(), |
||
99 | $item->getFrom()->getMailbox()->getEmailAddress(), |
||
100 | $item->getSubject(), |
||
101 | $item->getDateTimeSent()); |
||
102 | } |
||
103 | } else { |
||
104 | echo PHP_EOL . 'No message found'; |
||
105 | } |
||
106 | echo PHP_EOL; |
||
107 | } |
||
108 | } else { |
||
109 | /** |
||
110 | * In this case, we get the \SoapFault object |
||
111 | */ |
||
112 | print_r($find->getLastErrorForMethod('\Ews\ServiceType\EwsFind::FindItem')); |
||
113 | } |
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