1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpEws; |
4
|
|
|
|
5
|
|
|
use PhpEws\DataType\ExchangeImpersonationType; |
6
|
|
|
use PhpEws\Exception\EwsException; |
7
|
|
|
use PhpEws\Ntlm\ExchangeSoapClient; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Base class of the Exchange Web Services application. |
11
|
|
|
*/ |
12
|
|
|
class EwsConnection |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Microsoft Exchange 2007 |
16
|
|
|
* |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
const VERSION_2007 = 'Exchange2007'; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Microsoft Exchange 2007 SP1 |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
const VERSION_2007_SP1 = 'Exchange2007_SP1'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Microsoft Exchange 2007 SP2 |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
const VERSION_2007_SP2 = 'Exchange2007_SP2'; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Microsoft Exchange 2007 SP3 |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
const VERSION_2007_SP3 = 'Exchange2007_SP3'; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Microsoft Exchange 2010 |
44
|
|
|
* |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
const VERSION_2010 = 'Exchange2010'; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Microsoft Exchange 2010 SP1 |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
const VERSION_2010_SP1 = 'Exchange2010_SP1'; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Microsoft Exchange 2010 SP2 |
58
|
|
|
* |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
const VERSION_2010_SP2 = 'Exchange2010_SP2'; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Password to use when connecting to the Exchange server. |
65
|
|
|
* |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
protected $password; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Location of the Exchange server. |
72
|
|
|
* |
73
|
|
|
* @var string |
74
|
|
|
*/ |
75
|
|
|
protected $server; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* SOAP client used to make the request |
79
|
|
|
* |
80
|
|
|
* @var ExchangeSoapClient |
81
|
|
|
*/ |
82
|
|
|
protected $soap; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Username to use when connecting to the Exchange server. |
86
|
|
|
* |
87
|
|
|
* @var string |
88
|
|
|
*/ |
89
|
|
|
protected $username; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Exchange impersonation |
93
|
|
|
* |
94
|
|
|
* @var ExchangeImpersonationType |
95
|
|
|
*/ |
96
|
|
|
protected $impersonation; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Miscrosoft Exchange version that we are going to connect to |
100
|
|
|
* |
101
|
|
|
* @var string |
102
|
|
|
* |
103
|
|
|
* @see EwsConnection::VERSION_2007 |
104
|
|
|
* @see EwsConnection::VERSION_2007_SP1 |
105
|
|
|
* @see EwsConnection::VERSION_2010 |
106
|
|
|
* @see EwsConnection::VERSION_2010_SP1 |
107
|
|
|
*/ |
108
|
|
|
protected $version; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Constructor for the \PhpEws\EwsConnection class |
112
|
|
|
* |
113
|
|
|
* @param string $server |
114
|
|
|
* @param string $username |
115
|
|
|
* @param string $password |
116
|
|
|
* @param string $version one of the EwsConnection::VERSION_* constants |
117
|
|
|
*/ |
118
|
|
|
public function __construct( |
119
|
|
|
$server = null, |
120
|
|
|
$username = null, |
121
|
|
|
$password = null, |
122
|
|
|
$version = self::VERSION_2007 |
123
|
|
|
) { |
124
|
|
|
// Set the object properties. |
125
|
|
|
$this->setServer($server); |
126
|
|
|
$this->setUsername($username); |
127
|
|
|
$this->setPassword($password); |
128
|
|
|
$this->setVersion($version); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Returns the SOAP Client that may be used to make calls against the server |
133
|
|
|
* |
134
|
|
|
* @return ExchangeSoapClient |
135
|
|
|
*/ |
136
|
|
|
public function getClient() |
137
|
|
|
{ |
138
|
|
|
return $this->initializeSoapClient(); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Sets the impersonation property |
143
|
|
|
* |
144
|
|
|
* @param ExchangeImpersonationType $impersonation |
145
|
|
|
* |
146
|
|
|
* @return boolean |
147
|
|
|
*/ |
148
|
|
|
public function setImpersonation($impersonation) |
149
|
|
|
{ |
150
|
|
|
$this->impersonation = $impersonation; |
151
|
|
|
|
152
|
|
|
return true; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Sets the password property |
157
|
|
|
* |
158
|
|
|
* @param string $password |
159
|
|
|
*/ |
160
|
|
|
public function setPassword($password) |
161
|
|
|
{ |
162
|
|
|
$this->password = $password; |
163
|
|
|
|
164
|
|
|
return true; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Sets the server property |
169
|
|
|
* |
170
|
|
|
* @param string $server |
171
|
|
|
*/ |
172
|
|
|
public function setServer($server) |
173
|
|
|
{ |
174
|
|
|
$this->server = $server; |
175
|
|
|
|
176
|
|
|
return true; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Sets the user name property |
181
|
|
|
* |
182
|
|
|
* @param string $username |
183
|
|
|
*/ |
184
|
|
|
public function setUsername($username) |
185
|
|
|
{ |
186
|
|
|
$this->username = $username; |
187
|
|
|
|
188
|
|
|
return true; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Sets the version property |
193
|
|
|
* |
194
|
|
|
* @param string $version |
195
|
|
|
*/ |
196
|
|
|
public function setVersion($version) |
197
|
|
|
{ |
198
|
|
|
$this->version = $version; |
199
|
|
|
|
200
|
|
|
return true; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Function Description |
205
|
|
|
* |
206
|
|
|
* @param AddDelegateType $request |
207
|
|
|
* @return AddDelegateResponseMessageType |
208
|
|
|
*/ |
209
|
|
|
public function AddDelegate($request) |
210
|
|
|
{ |
211
|
|
|
$this->initializeSoapClient(); |
212
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
213
|
|
|
|
214
|
|
|
return $this->processResponse($response); |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Function Description |
219
|
|
|
* |
220
|
|
|
* @param ConvertIdType $request |
221
|
|
|
* @return ConvertIdResponseType |
222
|
|
|
*/ |
223
|
|
|
public function ConvertId($request) |
224
|
|
|
{ |
225
|
|
|
$this->initializeSoapClient(); |
226
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
227
|
|
|
|
228
|
|
|
return $this->processResponse($response); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Function Description |
233
|
|
|
* |
234
|
|
|
* @param CopyFolderType $request |
235
|
|
|
* @return CopyFolderResponseType |
236
|
|
|
*/ |
237
|
|
|
public function CopyFolder($request) |
238
|
|
|
{ |
239
|
|
|
$this->initializeSoapClient(); |
240
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
241
|
|
|
|
242
|
|
|
return $this->processResponse($response); |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Function Description |
247
|
|
|
* |
248
|
|
|
* @param CopyItemType $request |
249
|
|
|
* @return CopyItemResponseType |
250
|
|
|
*/ |
251
|
|
|
public function CopyItem($request) |
252
|
|
|
{ |
253
|
|
|
$this->initializeSoapClient(); |
254
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
255
|
|
|
|
256
|
|
|
return $this->processResponse($response); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Function Description |
261
|
|
|
* |
262
|
|
|
* @param CreateAttachmentType $request |
263
|
|
|
* @return CreateAttachmentResponseType |
264
|
|
|
*/ |
265
|
|
|
public function CreateAttachment($request) |
266
|
|
|
{ |
267
|
|
|
$this->initializeSoapClient(); |
268
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
269
|
|
|
|
270
|
|
|
return $this->processResponse($response); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* Function Description |
275
|
|
|
* |
276
|
|
|
* @param CreateFolderType $request |
277
|
|
|
* @return CreateFolderResponseType |
278
|
|
|
*/ |
279
|
|
|
public function CreateFolder($request) |
280
|
|
|
{ |
281
|
|
|
$this->initializeSoapClient(); |
282
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
283
|
|
|
|
284
|
|
|
return $this->processResponse($response); |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Function Description |
289
|
|
|
* |
290
|
|
|
* @param CreateItemType $request |
291
|
|
|
* @return CreateItemResponseType |
292
|
|
|
*/ |
293
|
|
|
public function CreateItem($request) |
294
|
|
|
{ |
295
|
|
|
$this->initializeSoapClient(); |
296
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
297
|
|
|
|
298
|
|
|
return $this->processResponse($response); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Function Description |
303
|
|
|
* |
304
|
|
|
* @param CreateManagedFolderRequestType $request |
305
|
|
|
* @return CreateManagedFolderResponseType |
306
|
|
|
*/ |
307
|
|
|
public function CreateManagedFolder($request) |
308
|
|
|
{ |
309
|
|
|
$this->initializeSoapClient(); |
310
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
311
|
|
|
|
312
|
|
|
return $this->processResponse($response); |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* Function Description |
317
|
|
|
* |
318
|
|
|
* @param DeleteAttachmentType $request |
319
|
|
|
* @return DeleteAttachmentResponseType |
320
|
|
|
*/ |
321
|
|
|
public function DeleteAttachment($request) |
322
|
|
|
{ |
323
|
|
|
$this->initializeSoapClient(); |
324
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
325
|
|
|
|
326
|
|
|
return $this->processResponse($response); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Function Description |
331
|
|
|
* |
332
|
|
|
* @param DeleteFolderType $request |
333
|
|
|
* @return DeleteFolderResponseType |
334
|
|
|
*/ |
335
|
|
|
public function DeleteFolder($request) |
336
|
|
|
{ |
337
|
|
|
$this->initializeSoapClient(); |
338
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
339
|
|
|
|
340
|
|
|
return $this->processResponse($response); |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* Function Description |
345
|
|
|
* |
346
|
|
|
* @param DeleteItemType $request |
347
|
|
|
* @return DeleteItemResponseType |
348
|
|
|
*/ |
349
|
|
|
public function DeleteItem($request) |
350
|
|
|
{ |
351
|
|
|
$this->initializeSoapClient(); |
352
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
353
|
|
|
|
354
|
|
|
return $this->processResponse($response); |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Function Description |
359
|
|
|
* |
360
|
|
|
* @param ExpandDLType $request |
361
|
|
|
* @return ExpandDLResponseType |
362
|
|
|
*/ |
363
|
|
|
public function ExpandDL($request) |
364
|
|
|
{ |
365
|
|
|
$this->initializeSoapClient(); |
366
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
367
|
|
|
|
368
|
|
|
return $this->processResponse($response); |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* Function Description |
373
|
|
|
* |
374
|
|
|
* @param EWS_FindFolderType $request |
375
|
|
|
* @return EWS_FindFolderResponseType |
376
|
|
|
*/ |
377
|
|
|
public function FindFolder($request) |
378
|
|
|
{ |
379
|
|
|
$this->initializeSoapClient(); |
380
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
381
|
|
|
|
382
|
|
|
return $this->processResponse($response); |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* Function Description |
387
|
|
|
* |
388
|
|
|
* @param FindItemType $request |
389
|
|
|
* @return FindItemResponseType |
390
|
|
|
*/ |
391
|
|
|
public function FindItem($request) |
392
|
|
|
{ |
393
|
|
|
$this->initializeSoapClient(); |
394
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
395
|
|
|
|
396
|
|
|
return $this->processResponse($response); |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* Function Description |
401
|
|
|
* |
402
|
|
|
* @param GetAttachmentType $request |
403
|
|
|
* @return GetAttachmentResponseType |
404
|
|
|
*/ |
405
|
|
|
public function GetAttachment($request) |
406
|
|
|
{ |
407
|
|
|
$this->initializeSoapClient(); |
408
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
409
|
|
|
|
410
|
|
|
return $this->processResponse($response); |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Function Description |
415
|
|
|
* |
416
|
|
|
* @param GetDelegateType $request |
417
|
|
|
* @return GetDelegateResponseMessageType |
418
|
|
|
*/ |
419
|
|
|
public function GetDelegate($request) |
420
|
|
|
{ |
421
|
|
|
$this->initializeSoapClient(); |
422
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
423
|
|
|
|
424
|
|
|
return $this->processResponse($response); |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* Function Description |
429
|
|
|
* |
430
|
|
|
* @param GetEventsType $request |
431
|
|
|
* @return GetEventsResponseType |
432
|
|
|
*/ |
433
|
|
|
public function GetEvents($request) |
434
|
|
|
{ |
435
|
|
|
$this->initializeSoapClient(); |
436
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
437
|
|
|
|
438
|
|
|
return $this->processResponse($response); |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* Function Description |
443
|
|
|
* |
444
|
|
|
* @param GetFolderType $request |
445
|
|
|
* @return GetFolderResponseType |
446
|
|
|
*/ |
447
|
|
|
public function GetFolder($request) |
448
|
|
|
{ |
449
|
|
|
$this->initializeSoapClient(); |
450
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
451
|
|
|
|
452
|
|
|
return $this->processResponse($response); |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
/** |
456
|
|
|
* Function Description |
457
|
|
|
* |
458
|
|
|
* @param GetItemType $request |
459
|
|
|
* @return GetItemResponseType |
460
|
|
|
*/ |
461
|
|
|
public function GetItem($request) |
462
|
|
|
{ |
463
|
|
|
$this->initializeSoapClient(); |
464
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
465
|
|
|
|
466
|
|
|
return $this->processResponse($response); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* Retrieve the timezones supported by the server. |
471
|
|
|
* |
472
|
|
|
* @param GetServerTimeZonesType $request |
473
|
|
|
* @return GetServerTimeZonesResponseType |
474
|
|
|
* |
475
|
|
|
* @since Exchange2010 |
476
|
|
|
*/ |
477
|
|
|
public function GetServerTimeZones($request) |
478
|
|
|
{ |
479
|
|
|
$this->initializeSoapClient(); |
480
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
481
|
|
|
|
482
|
|
|
return $this->processResponse($response); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* Function Description |
487
|
|
|
* |
488
|
|
|
* @param GetUserAvailabilityRequestType $request |
489
|
|
|
* @return GetUserAvailabilityResponseType |
490
|
|
|
*/ |
491
|
|
|
public function GetUserAvailability($request) |
492
|
|
|
{ |
493
|
|
|
$this->initializeSoapClient(); |
494
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
495
|
|
|
|
496
|
|
|
return $this->processResponse($response); |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
/** |
500
|
|
|
* Function Description |
501
|
|
|
* |
502
|
|
|
* @param GetUserOofSettingsRequest $request |
503
|
|
|
* @return GetUserOofSettingsResponse |
504
|
|
|
*/ |
505
|
|
|
public function GetUserOofSettings($request) |
506
|
|
|
{ |
507
|
|
|
$this->initializeSoapClient(); |
508
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
509
|
|
|
|
510
|
|
|
return $this->processResponse($response); |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
/** |
514
|
|
|
* Function Description |
515
|
|
|
* |
516
|
|
|
* @param MoveFolderType $request |
517
|
|
|
* @return MoveFolderResponseType |
518
|
|
|
*/ |
519
|
|
|
public function MoveFolder($request) |
520
|
|
|
{ |
521
|
|
|
$this->initializeSoapClient(); |
522
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
523
|
|
|
|
524
|
|
|
return $this->processResponse($response); |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
/** |
528
|
|
|
* Function Description |
529
|
|
|
* |
530
|
|
|
* @param MoveItemType $request |
531
|
|
|
* @return MoveItemResponseType |
532
|
|
|
*/ |
533
|
|
|
public function MoveItem($request) |
534
|
|
|
{ |
535
|
|
|
$this->initializeSoapClient(); |
536
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
537
|
|
|
|
538
|
|
|
return $this->processResponse($response); |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
/** |
542
|
|
|
* Function Description |
543
|
|
|
* |
544
|
|
|
* @param RemoveDelegateType $request |
545
|
|
|
* @return RemoveDelegateResponseMessageType |
546
|
|
|
*/ |
547
|
|
|
public function RemoveDelegate($request) |
548
|
|
|
{ |
549
|
|
|
$this->initializeSoapClient(); |
550
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
551
|
|
|
|
552
|
|
|
return $this->processResponse($response); |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* Function Description |
557
|
|
|
* |
558
|
|
|
* @param ResolveNamesType $request |
559
|
|
|
* @return ResolveNamesResponseType |
560
|
|
|
*/ |
561
|
|
|
public function ResolveNames($request) |
562
|
|
|
{ |
563
|
|
|
$this->initializeSoapClient(); |
564
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
565
|
|
|
|
566
|
|
|
return $this->processResponse($response); |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* Function Description |
571
|
|
|
* |
572
|
|
|
* @param SendItemType $request |
573
|
|
|
* @return SendItemResponseType |
574
|
|
|
*/ |
575
|
|
|
public function SendItem($request) |
576
|
|
|
{ |
577
|
|
|
$this->initializeSoapClient(); |
578
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
579
|
|
|
|
580
|
|
|
return $this->processResponse($response); |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* Function Description |
585
|
|
|
* |
586
|
|
|
* @param SetUserOofSettingsRequest $request |
587
|
|
|
* @return SetUserOofSettingsResponse |
588
|
|
|
*/ |
589
|
|
|
public function SetUserOofSettings($request) |
590
|
|
|
{ |
591
|
|
|
$this->initializeSoapClient(); |
592
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
593
|
|
|
|
594
|
|
|
return $this->processResponse($response); |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
/** |
598
|
|
|
* Function Description |
599
|
|
|
* |
600
|
|
|
* @param SubscribeType $request |
601
|
|
|
* @return SubscribeResponseType |
602
|
|
|
*/ |
603
|
|
|
public function Subscribe($request) |
604
|
|
|
{ |
605
|
|
|
$this->initializeSoapClient(); |
606
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
607
|
|
|
|
608
|
|
|
return $this->processResponse($response); |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* Function Description |
613
|
|
|
* |
614
|
|
|
* @param SyncFolderHierarchyType $request |
615
|
|
|
* @return SyncFolderHierarchyResponseType |
616
|
|
|
*/ |
617
|
|
|
public function SyncFolderHierarchy($request) |
618
|
|
|
{ |
619
|
|
|
$this->initializeSoapClient(); |
620
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
621
|
|
|
|
622
|
|
|
return $this->processResponse($response); |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
/** |
626
|
|
|
* Function Description |
627
|
|
|
* |
628
|
|
|
* @param SyncFolderItemsType $request |
629
|
|
|
* @return SyncFolderItemsResponseType |
630
|
|
|
*/ |
631
|
|
|
public function SyncFolderItems($request) |
632
|
|
|
{ |
633
|
|
|
$this->initializeSoapClient(); |
634
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
635
|
|
|
|
636
|
|
|
return $this->processResponse($response); |
637
|
|
|
} |
638
|
|
|
|
639
|
|
|
/** |
640
|
|
|
* Function Description |
641
|
|
|
* |
642
|
|
|
* @param UnsubscribeType $request |
643
|
|
|
* @return UnsubscribeResponseType |
644
|
|
|
*/ |
645
|
|
|
public function Unsubscribe($request) |
646
|
|
|
{ |
647
|
|
|
$this->initializeSoapClient(); |
648
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
649
|
|
|
|
650
|
|
|
return $this->processResponse($response); |
651
|
|
|
} |
652
|
|
|
|
653
|
|
|
/** |
654
|
|
|
* Function Description |
655
|
|
|
* |
656
|
|
|
* @param UpdateDelegateType $request |
657
|
|
|
* @return UpdateDelegateResponseMessageType |
658
|
|
|
*/ |
659
|
|
|
public function UpdateDelegate($request) |
660
|
|
|
{ |
661
|
|
|
$this->initializeSoapClient(); |
662
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
663
|
|
|
|
664
|
|
|
return $this->processResponse($response); |
665
|
|
|
} |
666
|
|
|
|
667
|
|
|
/** |
668
|
|
|
* Function Description |
669
|
|
|
* |
670
|
|
|
* @param UpdateFolderType $request |
671
|
|
|
* @return UpdateFolderResponseType |
672
|
|
|
*/ |
673
|
|
|
public function UpdateFolder($request) |
674
|
|
|
{ |
675
|
|
|
$this->initializeSoapClient(); |
676
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
677
|
|
|
|
678
|
|
|
return $this->processResponse($response); |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* Function Description |
683
|
|
|
* |
684
|
|
|
* @param UpdateItemType $request |
685
|
|
|
* @return UpdateItemResponseType |
686
|
|
|
*/ |
687
|
|
|
public function UpdateItem($request) |
688
|
|
|
{ |
689
|
|
|
$this->initializeSoapClient(); |
690
|
|
|
$response = $this->soap->{__FUNCTION__}($request); |
691
|
|
|
|
692
|
|
|
return $this->processResponse($response); |
693
|
|
|
} |
694
|
|
|
|
695
|
|
|
/** |
696
|
|
|
* Initializes the SoapClient object to make a request |
697
|
|
|
* |
698
|
|
|
* @return ExchangeSoapClient |
699
|
|
|
*/ |
700
|
|
|
protected function initializeSoapClient() |
701
|
|
|
{ |
702
|
|
|
$this->soap = new ExchangeSoapClient( |
703
|
|
|
dirname(__FILE__).'/wsdl/services.wsdl', |
704
|
|
|
array( |
705
|
|
|
'user' => $this->username, |
706
|
|
|
'password' => $this->password, |
707
|
|
|
'version' => $this->version, |
708
|
|
|
'location' => 'https://'.$this->server.'/EWS/Exchange.asmx', |
709
|
|
|
'impersonation' => $this->impersonation, |
710
|
|
|
) |
711
|
|
|
); |
712
|
|
|
|
713
|
|
|
return $this->soap; |
714
|
|
|
} |
715
|
|
|
|
716
|
|
|
/** |
717
|
|
|
* Process a response to verify that it succeeded and take the appropriate |
718
|
|
|
* action |
719
|
|
|
* |
720
|
|
|
* @throws EwsException If the response was not "OK" (200) |
721
|
|
|
* |
722
|
|
|
* @param stdClass $response |
723
|
|
|
* @return \PhpEws\DataType |
724
|
|
|
* |
725
|
|
|
* @todo Map the response to a real object. |
726
|
|
|
*/ |
727
|
|
|
protected function processResponse($response) |
728
|
|
|
{ |
729
|
|
|
// If the soap call failed then we need to thow an exception. |
730
|
|
|
$code = $this->soap->getResponseCode(); |
731
|
|
|
if ($code != 200) { |
732
|
|
|
throw new EwsException('SOAP client returned status of '.$code, $code); |
733
|
|
|
} |
734
|
|
|
|
735
|
|
|
return $response; |
736
|
|
|
} |
737
|
|
|
} |
738
|
|
|
|