Completed
Push — master ( 66a8a8...6457f5 )
by James
03:07
created

Client::GetConversationItems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Contains \jamesiarmes\PhpEws\Client.
4
 */
5
6
namespace jamesiarmes\PhpEws;
7
8
/**
9
 * Base class of the Exchange Web Services application.
10
 *
11
 * @package php-ews\Client
12
 */
13
class Client
14
{
15
    /**
16
     * Microsoft Exchange 2007
17
     *
18
     * @var string
19
     */
20
    const VERSION_2007 = 'Exchange2007';
21
22
    /**
23
     * Microsoft Exchange 2007 SP1
24
     *
25
     * @var string
26
     */
27
    const VERSION_2007_SP1 = 'Exchange2007_SP1';
28
29
    /**
30
     * Microsoft Exchange 2007 SP2
31
     *
32
     * @var string
33
     */
34
    const VERSION_2007_SP2 = 'Exchange2007_SP2';
35
36
    /**
37
     * Microsoft Exchange 2007 SP3
38
     *
39
     * @var string
40
     */
41
    const VERSION_2007_SP3 = 'Exchange2007_SP3';
42
43
    /**
44
     * Microsoft Exchange 2010
45
     *
46
     * @var string
47
     */
48
    const VERSION_2010 = 'Exchange2010';
49
50
    /**
51
     * Microsoft Exchange 2010 SP1
52
     *
53
     * @var string
54
     */
55
    const VERSION_2010_SP1 = 'Exchange2010_SP1';
56
57
    /**
58
     * Microsoft Exchange 2010 SP2
59
     *
60
     * @var string
61
     */
62
    const VERSION_2010_SP2 = 'Exchange2010_SP2';
63
64
    /**
65
     * Microsoft Exchange 2013.
66
     *
67
     * @var string
68
     */
69
    const VERSION_2013 = 'Exchange2013';
70
71
    /**
72
     * Microsoft Exchange 2013 SP1.
73
     *
74
     * @var string
75
     */
76
    const VERSION_2013_SP1 = 'Exchange2013_SP1';
77
78
    /**
79
     * Microsoft Exchange 2016.
80
     *
81
     * @var string
82
     */
83
    const VERSION_2016 = 'Exchange2016';
84
85
    /**
86
     * Password to use when connecting to the Exchange server.
87
     *
88
     * @var string
89
     */
90
    protected $password;
91
92
    /**
93
     * Location of the Exchange server.
94
     *
95
     * @var string
96
     */
97
    protected $server;
98
99
    /**
100
     * SOAP client used to make the request
101
     *
102
     * @var \jamesiarmes\PhpEws\SoapClient
103
     */
104
    protected $soap;
105
106
    /**
107
     * Username to use when connecting to the Exchange server.
108
     *
109
     * @var string
110
     */
111
    protected $username;
112
113
    /**
114
     * Exchange impersonation
115
     *
116
     * @var \jamesiarmes\PhpEws\Type\ExchangeImpersonationType
117
     */
118
    protected $impersonation;
119
120
    /**
121
     * Miscrosoft Exchange version that we are going to connect to
122
     *
123
     * @var string
124
     *
125
     * @see Client::VERSION_2007
126
     * @see Client::VERSION_2007_SP1
127
     * @see Client::VERSION_2007_SP2
128
     * @see Client::VERSION_2007_SP3
129
     * @see Client::VERSION_2010
130
     * @see Client::VERSION_2010_SP1
131
     * @see Client::VERSION_2010_SP2
132
     */
133
    protected $version;
134
135
    /**
136
     * Constructor for the ExchangeWebServices class
137
     *
138
     * @param string $server
139
     * @param string $username
140
     * @param string $password
141
     * @param string $version One of the Client::VERSION_* constants.
142
     */
143
    public function __construct(
144
        $server = null,
145
        $username = null,
146
        $password = null,
147
        $version = self::VERSION_2007
148
    ) {
149
        // Set the object properties.
150
        $this->setServer($server);
151
        $this->setUsername($username);
152
        $this->setPassword($password);
153
        $this->setVersion($version);
154
    }
155
156
    /**
157
     * Returns the SOAP Client that may be used to make calls against the server
158
     *
159
     * @return \jamesiarmes\PhpEws\SoapClient
160
     */
161
    public function getClient()
162
    {
163
        return $this->initializeSoapClient();
164
    }
165
166
    /**
167
     * Sets the impersonation property
168
     *
169
     * @param \jamesiarmes\PhpEws\Type\ExchangeImpersonationType $impersonation
170
     */
171
    public function setImpersonation($impersonation)
172
    {
173
        $this->impersonation = $impersonation;
174
175
        return true;
176
    }
177
178
    /**
179
     * Sets the password property
180
     *
181
     * @param string $password
182
     */
183
    public function setPassword($password)
184
    {
185
        $this->password = $password;
186
187
        return true;
188
    }
189
190
    /**
191
     * Sets the server property
192
     *
193
     * @param string $server
194
     */
195
    public function setServer($server)
196
    {
197
        $this->server = $server;
198
199
        return true;
200
    }
201
202
    /**
203
     * Sets the user name property
204
     *
205
     * @param string $username
206
     */
207
    public function setUsername($username)
208
    {
209
        $this->username = $username;
210
211
        return true;
212
    }
213
214
    /**
215
     * Sets the version property
216
     *
217
     * @param string $version
218
     */
219
    public function setVersion($version)
220
    {
221
        $this->version = $version;
222
223
        return true;
224
    }
225
226
    /**
227
     * Function Description
228
     *
229
     * @param \jamesiarmes\PhpEws\Request\AddDelegateType $request
230
     * @return \jamesiarmes\PhpEws\Response\AddDelegateResponseMessageType
231
     */
232
    public function AddDelegate($request)
233
    {
234
        $this->initializeSoapClient();
235
        $response = $this->soap->{__FUNCTION__}($request);
236
237
        return $this->processResponse($response);
238
    }
239
240
    /**
241
     * Adds a distribution group to the instant messaging (IM) list in the
242
     * Unified Contact Store.
243
     *
244
     * @since Exchange 2013
245
     *
246
     * @param \jamesiarmes\PhpEws\Request\AddDistributionGroupToImListType $request
247
     * @return \jamesiarmes\PhpEws\Response\AddDistributionGroupToImListResponseMessageType
248
     */
249
    public function AddDistributionGroupToImList($request)
250
    {
251
        $this->initializeSoapClient();
252
        $response = $this->soap->{__FUNCTION__}($request);
253
254
        return $this->processResponse($response);
255
    }
256
257
    /**
258
     * Adds an existing instant messaging (IM) contact to a group.
259
     *
260
     * @since Exchange 2013
261
     *
262
     * @param \jamesiarmes\PhpEws\Request\AddImContactToGroup $request
263
     * @return \jamesiarmes\PhpEws\Response\AddImContactToGroupResponseMessageType
264
     */
265
    public function AddImContactToGroup($request)
266
    {
267
        $this->initializeSoapClient();
268
        $response = $this->soap->{__FUNCTION__}($request);
269
270
        return $this->processResponse($response);
271
    }
272
273
    /**
274
     * Adds a new instant messaging (IM) group to a mailbox.
275
     *
276
     * @since Exchange 2013
277
     *
278
     * @param \jamesiarmes\PhpEws\Request\AddImGroupType $request
279
     * @return \jamesiarmes\PhpEws\Response\AddImGroupResponseMessageType
280
     */
281
    public function AddImGroup($request)
282
    {
283
        $this->initializeSoapClient();
284
        $response = $this->soap->{__FUNCTION__}($request);
285
286
        return $this->processResponse($response);
287
    }
288
289
    /**
290
     * Adds a new contact to an instant messaging (IM) group.
291
     *
292
     * @since Exchange 2013
293
     *
294
     * @param \jamesiarmes\PhpEws\Request\AddNewImContactToGroup $request
295
     * @return \jamesiarmes\PhpEws\Response\AddNewImContactToGroupResponseMessageType
296
     */
297
    public function AddNewImContactToGroup($request)
298
    {
299
        $this->initializeSoapClient();
300
        $response = $this->soap->{__FUNCTION__}($request);
301
302
        return $this->processResponse($response);
303
    }
304
305
    /**
306
     * Adds a new contact to a group based on a contact's phone number.
307
     *
308
     * @since Exchange 2013
309
     *
310
     * @param \jamesiarmes\PhpEws\Request\AddNewTelUriContactToGroupType $request
311
     * @return \jamesiarmes\PhpEws\Response\AddNewTelUriContactToGroupResponse
312
     */
313
    public function AddNewTelUriContactToGroup($request)
314
    {
315
        $this->initializeSoapClient();
316
        $response = $this->soap->{__FUNCTION__}($request);
317
318
        return $this->processResponse($response);
319
    }
320
321
    /**
322
     * Sets a one-time or follow up action on all the items in a conversation.
323
     *
324
     * This operation allows you to categorize, move, copy, delete, and set the
325
     * read state on all items in a conversation. Actions can also be set for
326
     * new messages in a conversation.
327
     *
328
     * @since Exchange 2010 SP1
329
     *
330
     * @param \jamesiarmes\PhpEws\Request\ApplyConversationActionType $request
331
     * @return \jamesiarmes\PhpEws\Response\ApplyConversationActionResponseType
332
     */
333
    public function ApplyConversationAction($request)
334
    {
335
        $this->initializeSoapClient();
336
        $response = $this->soap->{__FUNCTION__}($request);
337
338
        return $this->processResponse($response);
339
    }
340
341
    /**
342
     * Moves an item into the mailbox user's archive mailbox.
343
     *
344
     * @since Exchange 2013
345
     *
346
     * @param \jamesiarmes\PhpEws\Request\ArchiveItemType $request
347
     * @return \jamesiarmes\PhpEws\Response\ArchiveItemResponse
348
     */
349
    public function ArchiveItem($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 \jamesiarmes\PhpEws\Request\ConvertIdType $request
361
     * @return \jamesiarmes\PhpEws\Response\ConvertIdResponseType
362
     */
363
    public function ConvertId($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 \jamesiarmes\PhpEws\Request\CopyFolderType $request
375
     * @return \jamesiarmes\PhpEws\Response\CopyFolderResponseType
376
     */
377
    public function CopyFolder($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 \jamesiarmes\PhpEws\Request\CopyItemType $request
389
     * @return \jamesiarmes\PhpEws\Response\CopyItemResponseType
390
     */
391
    public function CopyItem($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 \jamesiarmes\PhpEws\Request\CreateAttachmentType $request
403
     * @return \jamesiarmes\PhpEws\Response\CreateAttachmentResponseType
404
     */
405
    public function CreateAttachment($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 \jamesiarmes\PhpEws\Request\CreateFolderType $request
417
     * @return \jamesiarmes\PhpEws\Response\CreateFolderResponseType
418
     */
419
    public function CreateFolder($request)
420
    {
421
        $this->initializeSoapClient();
422
        $response = $this->soap->{__FUNCTION__}($request);
423
424
        return $this->processResponse($response);
425
    }
426
427
    /**
428
     * Creates a folder hierarchy.
429
     *
430
     * @since Exchange 2013
431
     *
432
     * @param \jamesiarmes\PhpEws\Request\CreateFolderPathType $request
433
     * @return \jamesiarmes\PhpEws\Response\CreateFolderPathResponseType
434
     */
435
    public function CreateFolderPath($request)
436
    {
437
        $this->initializeSoapClient();
438
        $response = $this->soap->{__FUNCTION__}($request);
439
440
        return $this->processResponse($response);
441
    }
442
443
    /**
444
     * Function Description
445
     *
446
     * @param \jamesiarmes\PhpEws\Request\CreateItemType $request
447
     * @return \jamesiarmes\PhpEws\Response\CreateItemResponseType
448
     */
449
    public function CreateItem($request)
450
    {
451
        $this->initializeSoapClient();
452
        $response = $this->soap->{__FUNCTION__}($request);
453
454
        return $this->processResponse($response);
455
    }
456
457
    /**
458
     * Function Description
459
     *
460
     * @param \jamesiarmes\PhpEws\Request\CreateManagedFolderRequestType $request
461
     * @return \jamesiarmes\PhpEws\Response\CreateManagedFolderResponseType
462
     */
463
    public function CreateManagedFolder($request)
464
    {
465
        $this->initializeSoapClient();
466
        $response = $this->soap->{__FUNCTION__}($request);
467
468
        return $this->processResponse($response);
469
    }
470
471
    /**
472
     * Creates a user configuration object on a folder.
473
     *
474
     * @since Exchange 2010
475
     *
476
     * @param \jamesiarmes\PhpEws\Request\CreateUserConfigurationType $request
477
     * @return \jamesiarmes\PhpEws\Response\CreateUserConfigurationResponseType
478
     */
479
    public function CreateUserConfiguration($request)
480
    {
481
        $this->initializeSoapClient();
482
        $response = $this->soap->{__FUNCTION__}($request);
483
484
        return $this->processResponse($response);
485
    }
486
487
    /**
488
     * Function Description
489
     *
490
     * @param \jamesiarmes\PhpEws\Request\DeleteAttachmentType $request
491
     * @return \jamesiarmes\PhpEws\Response\DeleteAttachmentResponseType
492
     */
493
    public function DeleteAttachment($request)
494
    {
495
        $this->initializeSoapClient();
496
        $response = $this->soap->{__FUNCTION__}($request);
497
498
        return $this->processResponse($response);
499
    }
500
501
    /**
502
     * Function Description
503
     *
504
     * @param \jamesiarmes\PhpEws\Request\DeleteFolderType $request
505
     * @return \jamesiarmes\PhpEws\Response\DeleteFolderResponseType
506
     */
507
    public function DeleteFolder($request)
508
    {
509
        $this->initializeSoapClient();
510
        $response = $this->soap->{__FUNCTION__}($request);
511
512
        return $this->processResponse($response);
513
    }
514
515
    /**
516
     * Function Description
517
     *
518
     * @param \jamesiarmes\PhpEws\Request\DeleteItemType $request
519
     * @return \jamesiarmes\PhpEws\Response\DeleteItemResponseType
520
     */
521
    public function DeleteItem($request)
522
    {
523
        $this->initializeSoapClient();
524
        $response = $this->soap->{__FUNCTION__}($request);
525
526
        return $this->processResponse($response);
527
    }
528
529
    /**
530
     * Deletes a user configuration object on a folder.
531
     *
532
     * @since Exchange 2010
533
     *
534
     * @param \jamesiarmes\PhpEws\Request\DeleteUserConfigurationType $request
535
     * @return \jamesiarmes\PhpEws\Response\DeleteUserConfigurationResponseType
536
     */
537
    public function DeleteUserConfiguration($request)
538
    {
539
        $this->initializeSoapClient();
540
        $response = $this->soap->{__FUNCTION__}($request);
541
542
        return $this->processResponse($response);
543
    }
544
545
    /**
546
     * Disables a mail app for Outlook.
547
     *
548
     * @since Exchange 2013
549
     *
550
     * @param \jamesiarmes\PhpEws\Request\DisableAppType $request
551
     * @return \jamesiarmes\PhpEws\Response\DisableAppResponseType
552
     */
553
    public function DisableApp($request)
554
    {
555
        $this->initializeSoapClient();
556
        $response = $this->soap->{__FUNCTION__}($request);
557
558
        return $this->processResponse($response);
559
    }
560
561
    /**
562
     * Terminates a telephone call.
563
     *
564
     * @since Exchange 2010
565
     *
566
     * @param \jamesiarmes\PhpEws\Request\DisconnectPhoneCallType $request
567
     * @return \jamesiarmes\PhpEws\Response\DisconnectPhoneCallResponseMessageType
568
     */
569
    public function DisconnectPhoneCall($request)
570
    {
571
        $this->initializeSoapClient();
572
        $response = $this->soap->{__FUNCTION__}($request);
573
574
        return $this->processResponse($response);
575
    }
576
577
    /**
578
     * Empties folders in a mailbox.
579
     *
580
     * Optionally, this operation enables you to delete the subfolders of the
581
     * specified folder. When a subfolder is deleted, the subfolder and the
582
     * messages within the subfolder are deleted.
583
     *
584
     * @since Exchange 2010
585
     *
586
     * @param \jamesiarmes\PhpEws\Request\EmptyFolderType $request
587
     * @return \jamesiarmes\PhpEws\Response\EmptyFolderResponseType
588
     */
589
    public function EmptyFolder($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 \jamesiarmes\PhpEws\Request\ExpandDLType $request
601
     * @return \jamesiarmes\PhpEws\Response\ExpandDLResponseType
602
     */
603
    public function ExpandDL($request)
604
    {
605
        $this->initializeSoapClient();
606
        $response = $this->soap->{__FUNCTION__}($request);
607
608
        return $this->processResponse($response);
609
    }
610
611
    /**
612
     * Exports items out of a mailbox.
613
     *
614
     * @since Exchange 2010 SP1
615
     *
616
     * @param \jamesiarmes\PhpEws\Request\ExportItemsType $request
617
     * @return \jamesiarmes\PhpEws\Response\ExportItemsResponseType
618
     */
619
    public function ExportItems($request)
620
    {
621
        $this->initializeSoapClient();
622
        $response = $this->soap->{__FUNCTION__}($request);
623
624
        return $this->processResponse($response);
625
    }
626
627
    /**
628
     * Enumerates a list of conversations in a folder.
629
     *
630
     * @param \jamesiarmes\PhpEws\Request\FindConversationType $request
631
     * @return \jamesiarmes\PhpEws\Response\FindConversationResponseMessageType
632
     */
633
    public function FindConversation($request)
634
    {
635
        $this->initializeSoapClient();
636
        $response = $this->soap->{__FUNCTION__}($request);
637
638
        return $this->processResponse($response);
639
    }
640
641
    /**
642
     * Function Description
643
     *
644
     * @param \jamesiarmes\PhpEws\Request\FindFolderType $request
645
     * @return \jamesiarmes\PhpEws\Response\FindFolderResponseType
646
     */
647
    public function FindFolder($request)
648
    {
649
        $this->initializeSoapClient();
650
        $response = $this->soap->{__FUNCTION__}($request);
651
652
        return $this->processResponse($response);
653
    }
654
655
    /**
656
     * Function Description
657
     *
658
     * @param \jamesiarmes\PhpEws\Request\FindItemType $request
659
     * @return \jamesiarmes\PhpEws\Response\FindItemResponseType
660
     */
661
    public function FindItem($request)
662
    {
663
        $this->initializeSoapClient();
664
        $response = $this->soap->{__FUNCTION__}($request);
665
666
        return $this->processResponse($response);
667
    }
668
669
    /**
670
     * Finds messages that meet the specified criteria.
671
     *
672
     * @since Exchange 2010
673
     *
674
     * @param \jamesiarmes\PhpEws\Request\FindMessageTrackingReportRequestType $request
675
     * @return \jamesiarmes\PhpEws\Response\FindMessageTrackingReportResponseMessageType
676
     */
677
    public function FindMessageTrackingReport($request)
678
    {
679
        $this->initializeSoapClient();
680
        $response = $this->soap->{__FUNCTION__}($request);
681
682
        return $this->processResponse($response);
683
    }
684
685
    /**
686
     * Returns all persona objects from a specified Contacts folder or retrieves
687
     * contacts that match a specified query string.
688
     *
689
     * @since Exchange 2013
690
     *
691
     * @param \jamesiarmes\PhpEws\Request\FindPeopleType $request
692
     * @return \jamesiarmes\PhpEws\Response\FindPeopleResponseMessageType
693
     */
694
    public function FindPeople($request)
695
    {
696
        $this->initializeSoapClient();
697
        $response = $this->soap->{__FUNCTION__}($request);
698
699
        return $this->processResponse($response);
700
    }
701
702
    /**
703
     * Retrieves app manifests.
704
     *
705
     * @since Exchange 2013 SP1
706
     *
707
     * @param \jamesiarmes\PhpEws\Request\GetAppManifestsType $request
708
     * @return \jamesiarmes\PhpEws\Response\GetAppManifestsResponseType
709
     */
710
    public function GetAppManifests($request)
711
    {
712
        $this->initializeSoapClient();
713
        $response = $this->soap->{__FUNCTION__}($request);
714
715
        return $this->processResponse($response);
716
    }
717
718
    /**
719
     * Retrieves the URL for the app marketplace that a client can visit to
720
     * acquire apps to install in a mailbox.
721
     *
722
     * @since Exchange 2013 SP1
723
     *
724
     * @param \jamesiarmes\PhpEws\Request\GetAppMarketplaceUrl $request
725
     * @return \jamesiarmes\PhpEws\Response\GetAppMarketplaceUrlResponseMessageType
726
     */
727
    public function GetAppMarketplaceUrl($request)
728
    {
729
        $this->initializeSoapClient();
730
        $response = $this->soap->{__FUNCTION__}($request);
731
732
        return $this->processResponse($response);
733
    }
734
735
    /**
736
     * Function Description
737
     *
738
     * @param \jamesiarmes\PhpEws\Request\GetAttachmentType $request
739
     * @return \jamesiarmes\PhpEws\Response\GetAttachmentResponseType
740
     */
741
    public function GetAttachment($request)
742
    {
743
        $this->initializeSoapClient();
744
        $response = $this->soap->{__FUNCTION__}($request);
745
746
        return $this->processResponse($response);
747
    }
748
749
    /**
750
     * Gets a client access token for a mail app for Outlook.
751
     *
752
     * @since Exchange 2013
753
     *
754
     * @param \jamesiarmes\PhpEws\Request\GetClientAccessTokenType $request
755
     * @return \jamesiarmes\PhpEws\Response\GetClientAccessTokenResponseType
756
     */
757
    public function GetClientAccessToken($request)
758
    {
759
        $this->initializeSoapClient();
760
        $response = $this->soap->{__FUNCTION__}($request);
761
762
        return $this->processResponse($response);
763
    }
764
765
    /**
766
     * Retrieves one or more sets of items that are organized in to nodes in a
767
     * conversation.
768
     *
769
     * @since Exchange 2013
770
     *
771
     * @param \jamesiarmes\PhpEws\Request\GetConversationItemsType $request
772
     * @return \jamesiarmes\PhpEws\Response\GetConversationItemsResponseType
773
     */
774
    public function GetConversationItems($request)
775
    {
776
        $this->initializeSoapClient();
777
        $response = $this->soap->{__FUNCTION__}($request);
778
779
        return $this->processResponse($response);
780
    }
781
782
    /**
783
     * Function Description
784
     *
785
     * @param \jamesiarmes\PhpEws\Request\GetDelegateType $request
786
     * @return \jamesiarmes\PhpEws\Response\GetDelegateResponseMessageType
787
     */
788
    public function GetDelegate($request)
789
    {
790
        $this->initializeSoapClient();
791
        $response = $this->soap->{__FUNCTION__}($request);
792
793
        return $this->processResponse($response);
794
    }
795
796
    /**
797
     * Function Description
798
     *
799
     * @param \jamesiarmes\PhpEws\Request\GetEventsType $request
800
     * @return \jamesiarmes\PhpEws\Response\GetEventsResponseType
801
     */
802
    public function GetEvents($request)
803
    {
804
        $this->initializeSoapClient();
805
        $response = $this->soap->{__FUNCTION__}($request);
806
807
        return $this->processResponse($response);
808
    }
809
810
    /**
811
     * Function Description
812
     *
813
     * @param \jamesiarmes\PhpEws\Request\GetFolderType $request
814
     * @return \jamesiarmes\PhpEws\Response\GetFolderResponseType
815
     */
816
    public function GetFolder($request)
817
    {
818
        $this->initializeSoapClient();
819
        $response = $this->soap->{__FUNCTION__}($request);
820
821
        return $this->processResponse($response);
822
    }
823
824
    /**
825
     * Function Description
826
     *
827
     * @param \jamesiarmes\PhpEws\Request\GetItemType $request
828
     * @return \jamesiarmes\PhpEws\Response\GetItemResponseType
829
     */
830
    public function GetItem($request)
831
    {
832
        $this->initializeSoapClient();
833
        $response = $this->soap->{__FUNCTION__}($request);
834
835
        return $this->processResponse($response);
836
    }
837
838
    /**
839
     * Retrieve the timezones supported by the server.
840
     *
841
     * @since Exchange 2010
842
     *
843
     * @param \jamesiarmes\PhpEws\Request\GetServerTimeZonesType $request
844
     * @return \jamesiarmes\PhpEws\Response\GetServerTimeZonesResponseType
845
     */
846
    public function GetServerTimeZones($request)
847
    {
848
        $this->initializeSoapClient();
849
        $response = $this->soap->{__FUNCTION__}($request);
850
851
        return $this->processResponse($response);
852
    }
853
854
    /**
855
     * Function Description
856
     *
857
     * @param \jamesiarmes\PhpEws\Request\GetUserAvailabilityRequestType $request
858
     * @return \jamesiarmes\PhpEws\Response\GetUserAvailabilityResponseType
859
     */
860
    public function GetUserAvailability($request)
861
    {
862
        $this->initializeSoapClient();
863
        $response = $this->soap->{__FUNCTION__}($request);
864
865
        return $this->processResponse($response);
866
    }
867
868
    /**
869
     * Function Description
870
     *
871
     * @param \jamesiarmes\PhpEws\Request\GetUserOofSettingsRequest $request
872
     * @return \jamesiarmes\PhpEws\Response\GetUserOofSettingsResponse
873
     */
874
    public function GetUserOofSettings($request)
875
    {
876
        $this->initializeSoapClient();
877
        $response = $this->soap->{__FUNCTION__}($request);
878
879
        return $this->processResponse($response);
880
    }
881
882
    /**
883
     * Function Description
884
     *
885
     * @param \jamesiarmes\PhpEws\Request\MoveFolderType $request
886
     * @return \jamesiarmes\PhpEws\Response\MoveFolderResponseType
887
     */
888
    public function MoveFolder($request)
889
    {
890
        $this->initializeSoapClient();
891
        $response = $this->soap->{__FUNCTION__}($request);
892
893
        return $this->processResponse($response);
894
    }
895
896
    /**
897
     * Function Description
898
     *
899
     * @param \jamesiarmes\PhpEws\Request\MoveItemType $request
900
     * @return \jamesiarmes\PhpEws\Response\MoveItemResponseType
901
     */
902
    public function MoveItem($request)
903
    {
904
        $this->initializeSoapClient();
905
        $response = $this->soap->{__FUNCTION__}($request);
906
907
        return $this->processResponse($response);
908
    }
909
910
    /**
911
     * Function Description
912
     *
913
     * @param \jamesiarmes\PhpEws\Request\RemoveDelegateType $request
914
     * @return \jamesiarmes\PhpEws\Response\RemoveDelegateResponseMessageType
915
     */
916
    public function RemoveDelegate($request)
917
    {
918
        $this->initializeSoapClient();
919
        $response = $this->soap->{__FUNCTION__}($request);
920
921
        return $this->processResponse($response);
922
    }
923
924
    /**
925
     * Function Description
926
     *
927
     * @param \jamesiarmes\PhpEws\Request\ResolveNamesType $request
928
     * @return \jamesiarmes\PhpEws\Response\ResolveNamesResponseType
929
     */
930
    public function ResolveNames($request)
931
    {
932
        $this->initializeSoapClient();
933
        $response = $this->soap->{__FUNCTION__}($request);
934
935
        return $this->processResponse($response);
936
    }
937
938
    /**
939
     * Function Description
940
     *
941
     * @param \jamesiarmes\PhpEws\Request\SendItemType $request
942
     * @return \jamesiarmes\PhpEws\Response\SendItemResponseType
943
     */
944
    public function SendItem($request)
945
    {
946
        $this->initializeSoapClient();
947
        $response = $this->soap->{__FUNCTION__}($request);
948
949
        return $this->processResponse($response);
950
    }
951
952
    /**
953
     * Function Description
954
     *
955
     * @param \jamesiarmes\PhpEws\Request\SetUserOofSettingsRequest $request
956
     * @return \jamesiarmes\PhpEws\Response\SetUserOofSettingsResponse
957
     */
958
    public function SetUserOofSettings($request)
959
    {
960
        $this->initializeSoapClient();
961
        $response = $this->soap->{__FUNCTION__}($request);
962
963
        return $this->processResponse($response);
964
    }
965
966
    /**
967
     * Function Description
968
     *
969
     * @param \jamesiarmes\PhpEws\Request\SubscribeType $request
970
     * @return \jamesiarmes\PhpEws\Response\SubscribeResponseType
971
     */
972
    public function Subscribe($request)
973
    {
974
        $this->initializeSoapClient();
975
        $response = $this->soap->{__FUNCTION__}($request);
976
977
        return $this->processResponse($response);
978
    }
979
980
    /**
981
     * Function Description
982
     *
983
     * @param \jamesiarmes\PhpEws\Request\SyncFolderHierarchyType $request
984
     * @return \jamesiarmes\PhpEws\Response\SyncFolderHierarchyResponseType
985
     */
986
    public function SyncFolderHierarchy($request)
987
    {
988
        $this->initializeSoapClient();
989
        $response = $this->soap->{__FUNCTION__}($request);
990
991
        return $this->processResponse($response);
992
    }
993
994
    /**
995
     * Function Description
996
     *
997
     * @param \jamesiarmes\PhpEws\Request\SyncFolderItemsType $request
998
     * @return \jamesiarmes\PhpEws\Response\SyncFolderItemsResponseType
999
     */
1000
    public function SyncFolderItems($request)
1001
    {
1002
        $this->initializeSoapClient();
1003
        $response = $this->soap->{__FUNCTION__}($request);
1004
1005
        return $this->processResponse($response);
1006
    }
1007
1008
    /**
1009
     * Function Description
1010
     *
1011
     * @param \jamesiarmes\PhpEws\Request\UnsubscribeType $request
1012
     * @return \jamesiarmes\PhpEws\Response\UnsubscribeResponseType
1013
     */
1014
    public function Unsubscribe($request)
1015
    {
1016
        $this->initializeSoapClient();
1017
        $response = $this->soap->{__FUNCTION__}($request);
1018
1019
        return $this->processResponse($response);
1020
    }
1021
1022
    /**
1023
     * Function Description
1024
     *
1025
     * @param \jamesiarmes\PhpEws\Request\UpdateDelegateType $request
1026
     * @return \jamesiarmes\PhpEws\Response\UpdateDelegateResponseMessageType
1027
     */
1028
    public function UpdateDelegate($request)
1029
    {
1030
        $this->initializeSoapClient();
1031
        $response = $this->soap->{__FUNCTION__}($request);
1032
1033
        return $this->processResponse($response);
1034
    }
1035
1036
    /**
1037
     * Function Description
1038
     *
1039
     * @param \jamesiarmes\PhpEws\Request\UpdateFolderType $request
1040
     * @return \jamesiarmes\PhpEws\Response\UpdateFolderResponseType
1041
     */
1042
    public function UpdateFolder($request)
1043
    {
1044
        $this->initializeSoapClient();
1045
        $response = $this->soap->{__FUNCTION__}($request);
1046
1047
        return $this->processResponse($response);
1048
    }
1049
1050
    /**
1051
     * Function Description
1052
     *
1053
     * @param \jamesiarmes\PhpEws\Request\UpdateItemType $request
1054
     * @return \jamesiarmes\PhpEws\Response\UpdateItemResponseType
1055
     */
1056
    public function UpdateItem($request)
1057
    {
1058
        $this->initializeSoapClient();
1059
        $response = $this->soap->{__FUNCTION__}($request);
1060
1061
        return $this->processResponse($response);
1062
    }
1063
1064
    /**
1065
     * Initializes the SoapClient object to make a request
1066
     *
1067
     * @return \jamesiarmes\PhpEws\SoapClient
1068
     *
1069
     * TODO: Build a class map that we can pass to the client.
1070
     */
1071
    protected function initializeSoapClient()
1072
    {
1073
        $this->soap = new SoapClient(
1074
            dirname(__FILE__) . '/assets/services.wsdl',
1075
            array(
1076
                'user' => $this->username,
1077
                'password' => $this->password,
1078
                'version' => $this->version,
1079
                'location' => 'https://' . $this->server . '/EWS/Exchange.asmx',
1080
                'impersonation' => $this->impersonation,
1081
            )
1082
        );
1083
1084
        return $this->soap;
1085
    }
1086
1087
    /**
1088
     * Process a response to verify that it succeeded and take the appropriate
1089
     * action
1090
     *
1091
     * @throws \Exception
1092
     *
1093
     * @param \stdClass $response
1094
     * @return \stdClass
1095
     */
1096
    protected function processResponse($response)
1097
    {
1098
        // If the soap call failed then we need to throw an exception.
1099
        $code = $this->soap->getResponseCode();
1100
        if ($code != 200) {
1101
            throw new \Exception(
1102
                "SOAP client returned status of $code.",
1103
                $code
1104
            );
1105
        }
1106
1107
        return $response;
1108
    }
1109
}
1110