Completed
Push — master ( b70198...9a4631 )
by James
03:07
created

Client::CopyFolder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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
        return $this->makeRequest(__FUNCTION__, $request);
235
    }
236
237
    /**
238
     * Adds a distribution group to the instant messaging (IM) list in the
239
     * Unified Contact Store.
240
     *
241
     * @since Exchange 2013
242
     *
243
     * @param \jamesiarmes\PhpEws\Request\AddDistributionGroupToImListType $request
244
     * @return \jamesiarmes\PhpEws\Response\AddDistributionGroupToImListResponseMessageType
245
     */
246
    public function AddDistributionGroupToImList($request)
247
    {
248
        return $this->makeRequest(__FUNCTION__, $request);
249
    }
250
251
    /**
252
     * Adds an existing instant messaging (IM) contact to a group.
253
     *
254
     * @since Exchange 2013
255
     *
256
     * @param \jamesiarmes\PhpEws\Request\AddImContactToGroup $request
257
     * @return \jamesiarmes\PhpEws\Response\AddImContactToGroupResponseMessageType
258
     */
259
    public function AddImContactToGroup($request)
260
    {
261
        return $this->makeRequest(__FUNCTION__, $request);
262
    }
263
264
    /**
265
     * Adds a new instant messaging (IM) group to a mailbox.
266
     *
267
     * @since Exchange 2013
268
     *
269
     * @param \jamesiarmes\PhpEws\Request\AddImGroupType $request
270
     * @return \jamesiarmes\PhpEws\Response\AddImGroupResponseMessageType
271
     */
272
    public function AddImGroup($request)
273
    {
274
        return $this->makeRequest(__FUNCTION__, $request);
275
    }
276
277
    /**
278
     * Adds a new contact to an instant messaging (IM) group.
279
     *
280
     * @since Exchange 2013
281
     *
282
     * @param \jamesiarmes\PhpEws\Request\AddNewImContactToGroup $request
283
     * @return \jamesiarmes\PhpEws\Response\AddNewImContactToGroupResponseMessageType
284
     */
285
    public function AddNewImContactToGroup($request)
286
    {
287
        return $this->makeRequest(__FUNCTION__, $request);
288
    }
289
290
    /**
291
     * Adds a new contact to a group based on a contact's phone number.
292
     *
293
     * @since Exchange 2013
294
     *
295
     * @param \jamesiarmes\PhpEws\Request\AddNewTelUriContactToGroupType $request
296
     * @return \jamesiarmes\PhpEws\Response\AddNewTelUriContactToGroupResponse
297
     */
298
    public function AddNewTelUriContactToGroup($request)
299
    {
300
        return $this->makeRequest(__FUNCTION__, $request);
301
    }
302
303
    /**
304
     * Sets a one-time or follow up action on all the items in a conversation.
305
     *
306
     * This operation allows you to categorize, move, copy, delete, and set the
307
     * read state on all items in a conversation. Actions can also be set for
308
     * new messages in a conversation.
309
     *
310
     * @since Exchange 2010 SP1
311
     *
312
     * @param \jamesiarmes\PhpEws\Request\ApplyConversationActionType $request
313
     * @return \jamesiarmes\PhpEws\Response\ApplyConversationActionResponseType
314
     */
315
    public function ApplyConversationAction($request)
316
    {
317
        return $this->makeRequest(__FUNCTION__, $request);
318
    }
319
320
    /**
321
     * Moves an item into the mailbox user's archive mailbox.
322
     *
323
     * @since Exchange 2013
324
     *
325
     * @param \jamesiarmes\PhpEws\Request\ArchiveItemType $request
326
     * @return \jamesiarmes\PhpEws\Response\ArchiveItemResponse
327
     */
328
    public function ArchiveItem($request)
329
    {
330
        return $this->makeRequest(__FUNCTION__, $request);
331
    }
332
333
    /**
334
     * Function Description
335
     *
336
     * @param \jamesiarmes\PhpEws\Request\ConvertIdType $request
337
     * @return \jamesiarmes\PhpEws\Response\ConvertIdResponseType
338
     */
339
    public function ConvertId($request)
340
    {
341
        return $this->makeRequest(__FUNCTION__, $request);
342
    }
343
344
    /**
345
     * Function Description
346
     *
347
     * @param \jamesiarmes\PhpEws\Request\CopyFolderType $request
348
     * @return \jamesiarmes\PhpEws\Response\CopyFolderResponseType
349
     */
350
    public function CopyFolder($request)
351
    {
352
        return $this->makeRequest(__FUNCTION__, $request);
353
    }
354
355
    /**
356
     * Function Description
357
     *
358
     * @param \jamesiarmes\PhpEws\Request\CopyItemType $request
359
     * @return \jamesiarmes\PhpEws\Response\CopyItemResponseType
360
     */
361
    public function CopyItem($request)
362
    {
363
        return $this->makeRequest(__FUNCTION__, $request);
364
    }
365
366
    /**
367
     * Function Description
368
     *
369
     * @param \jamesiarmes\PhpEws\Request\CreateAttachmentType $request
370
     * @return \jamesiarmes\PhpEws\Response\CreateAttachmentResponseType
371
     */
372
    public function CreateAttachment($request)
373
    {
374
        return $this->makeRequest(__FUNCTION__, $request);
375
    }
376
377
    /**
378
     * Function Description
379
     *
380
     * @param \jamesiarmes\PhpEws\Request\CreateFolderType $request
381
     * @return \jamesiarmes\PhpEws\Response\CreateFolderResponseType
382
     */
383
    public function CreateFolder($request)
384
    {
385
        return $this->makeRequest(__FUNCTION__, $request);
386
    }
387
388
    /**
389
     * Creates a folder hierarchy.
390
     *
391
     * @since Exchange 2013
392
     *
393
     * @param \jamesiarmes\PhpEws\Request\CreateFolderPathType $request
394
     * @return \jamesiarmes\PhpEws\Response\CreateFolderPathResponseType
395
     */
396
    public function CreateFolderPath($request)
397
    {
398
        return $this->makeRequest(__FUNCTION__, $request);
399
    }
400
401
    /**
402
     * Function Description
403
     *
404
     * @param \jamesiarmes\PhpEws\Request\CreateItemType $request
405
     * @return \jamesiarmes\PhpEws\Response\CreateItemResponseType
406
     */
407
    public function CreateItem($request)
408
    {
409
        return $this->makeRequest(__FUNCTION__, $request);
410
    }
411
412
    /**
413
     * Function Description
414
     *
415
     * @param \jamesiarmes\PhpEws\Request\CreateManagedFolderRequestType $request
416
     * @return \jamesiarmes\PhpEws\Response\CreateManagedFolderResponseType
417
     */
418
    public function CreateManagedFolder($request)
419
    {
420
        return $this->makeRequest(__FUNCTION__, $request);
421
    }
422
423
    /**
424
     * Creates a user configuration object on a folder.
425
     *
426
     * @since Exchange 2010
427
     *
428
     * @param \jamesiarmes\PhpEws\Request\CreateUserConfigurationType $request
429
     * @return \jamesiarmes\PhpEws\Response\CreateUserConfigurationResponseType
430
     */
431
    public function CreateUserConfiguration($request)
432
    {
433
        return $this->makeRequest(__FUNCTION__, $request);
434
    }
435
436
    /**
437
     * Function Description
438
     *
439
     * @param \jamesiarmes\PhpEws\Request\DeleteAttachmentType $request
440
     * @return \jamesiarmes\PhpEws\Response\DeleteAttachmentResponseType
441
     */
442
    public function DeleteAttachment($request)
443
    {
444
        return $this->makeRequest(__FUNCTION__, $request);
445
    }
446
447
    /**
448
     * Function Description
449
     *
450
     * @param \jamesiarmes\PhpEws\Request\DeleteFolderType $request
451
     * @return \jamesiarmes\PhpEws\Response\DeleteFolderResponseType
452
     */
453
    public function DeleteFolder($request)
454
    {
455
        return $this->makeRequest(__FUNCTION__, $request);
456
    }
457
458
    /**
459
     * Function Description
460
     *
461
     * @param \jamesiarmes\PhpEws\Request\DeleteItemType $request
462
     * @return \jamesiarmes\PhpEws\Response\DeleteItemResponseType
463
     */
464
    public function DeleteItem($request)
465
    {
466
        return $this->makeRequest(__FUNCTION__, $request);
467
    }
468
469
    /**
470
     * Deletes a user configuration object on a folder.
471
     *
472
     * @since Exchange 2010
473
     *
474
     * @param \jamesiarmes\PhpEws\Request\DeleteUserConfigurationType $request
475
     * @return \jamesiarmes\PhpEws\Response\DeleteUserConfigurationResponseType
476
     */
477
    public function DeleteUserConfiguration($request)
478
    {
479
        return $this->makeRequest(__FUNCTION__, $request);
480
    }
481
482
    /**
483
     * Disables a mail app for Outlook.
484
     *
485
     * @since Exchange 2013
486
     *
487
     * @param \jamesiarmes\PhpEws\Request\DisableAppType $request
488
     * @return \jamesiarmes\PhpEws\Response\DisableAppResponseType
489
     */
490
    public function DisableApp($request)
491
    {
492
        return $this->makeRequest(__FUNCTION__, $request);
493
    }
494
495
    /**
496
     * Terminates a telephone call.
497
     *
498
     * @since Exchange 2010
499
     *
500
     * @param \jamesiarmes\PhpEws\Request\DisconnectPhoneCallType $request
501
     * @return \jamesiarmes\PhpEws\Response\DisconnectPhoneCallResponseMessageType
502
     */
503
    public function DisconnectPhoneCall($request)
504
    {
505
        return $this->makeRequest(__FUNCTION__, $request);
506
    }
507
508
    /**
509
     * Empties folders in a mailbox.
510
     *
511
     * Optionally, this operation enables you to delete the subfolders of the
512
     * specified folder. When a subfolder is deleted, the subfolder and the
513
     * messages within the subfolder are deleted.
514
     *
515
     * @since Exchange 2010
516
     *
517
     * @param \jamesiarmes\PhpEws\Request\EmptyFolderType $request
518
     * @return \jamesiarmes\PhpEws\Response\EmptyFolderResponseType
519
     */
520
    public function EmptyFolder($request)
521
    {
522
        return $this->makeRequest(__FUNCTION__, $request);
523
    }
524
525
    /**
526
     * Function Description
527
     *
528
     * @param \jamesiarmes\PhpEws\Request\ExpandDLType $request
529
     * @return \jamesiarmes\PhpEws\Response\ExpandDLResponseType
530
     */
531
    public function ExpandDL($request)
532
    {
533
        return $this->makeRequest(__FUNCTION__, $request);
534
    }
535
536
    /**
537
     * Exports items out of a mailbox.
538
     *
539
     * @since Exchange 2010 SP1
540
     *
541
     * @param \jamesiarmes\PhpEws\Request\ExportItemsType $request
542
     * @return \jamesiarmes\PhpEws\Response\ExportItemsResponseType
543
     */
544
    public function ExportItems($request)
545
    {
546
        return $this->makeRequest(__FUNCTION__, $request);
547
    }
548
549
    /**
550
     * Enumerates a list of conversations in a folder.
551
     *
552
     * @param \jamesiarmes\PhpEws\Request\FindConversationType $request
553
     * @return \jamesiarmes\PhpEws\Response\FindConversationResponseMessageType
554
     */
555
    public function FindConversation($request)
556
    {
557
        return $this->makeRequest(__FUNCTION__, $request);
558
    }
559
560
    /**
561
     * Function Description
562
     *
563
     * @param \jamesiarmes\PhpEws\Request\FindFolderType $request
564
     * @return \jamesiarmes\PhpEws\Response\FindFolderResponseType
565
     */
566
    public function FindFolder($request)
567
    {
568
        return $this->makeRequest(__FUNCTION__, $request);
569
    }
570
571
    /**
572
     * Function Description
573
     *
574
     * @param \jamesiarmes\PhpEws\Request\FindItemType $request
575
     * @return \jamesiarmes\PhpEws\Response\FindItemResponseType
576
     */
577
    public function FindItem($request)
578
    {
579
        return $this->makeRequest(__FUNCTION__, $request);
580
    }
581
582
    /**
583
     * Finds messages that meet the specified criteria.
584
     *
585
     * @since Exchange 2010
586
     *
587
     * @param \jamesiarmes\PhpEws\Request\FindMessageTrackingReportRequestType $request
588
     * @return \jamesiarmes\PhpEws\Response\FindMessageTrackingReportResponseMessageType
589
     */
590
    public function FindMessageTrackingReport($request)
591
    {
592
        return $this->makeRequest(__FUNCTION__, $request);
593
    }
594
595
    /**
596
     * Returns all persona objects from a specified Contacts folder or retrieves
597
     * contacts that match a specified query string.
598
     *
599
     * @since Exchange 2013
600
     *
601
     * @param \jamesiarmes\PhpEws\Request\FindPeopleType $request
602
     * @return \jamesiarmes\PhpEws\Response\FindPeopleResponseMessageType
603
     */
604
    public function FindPeople($request)
605
    {
606
        return $this->makeRequest(__FUNCTION__, $request);
607
    }
608
609
    /**
610
     * Retrieves app manifests.
611
     *
612
     * @since Exchange 2013 SP1
613
     *
614
     * @param \jamesiarmes\PhpEws\Request\GetAppManifestsType $request
615
     * @return \jamesiarmes\PhpEws\Response\GetAppManifestsResponseType
616
     */
617
    public function GetAppManifests($request)
618
    {
619
        return $this->makeRequest(__FUNCTION__, $request);
620
    }
621
622
    /**
623
     * Retrieves the URL for the app marketplace that a client can visit to
624
     * acquire apps to install in a mailbox.
625
     *
626
     * @since Exchange 2013 SP1
627
     *
628
     * @param \jamesiarmes\PhpEws\Request\GetAppMarketplaceUrl $request
629
     * @return \jamesiarmes\PhpEws\Response\GetAppMarketplaceUrlResponseMessageType
630
     */
631
    public function GetAppMarketplaceUrl($request)
632
    {
633
        return $this->makeRequest(__FUNCTION__, $request);
634
    }
635
636
    /**
637
     * Function Description
638
     *
639
     * @param \jamesiarmes\PhpEws\Request\GetAttachmentType $request
640
     * @return \jamesiarmes\PhpEws\Response\GetAttachmentResponseType
641
     */
642
    public function GetAttachment($request)
643
    {
644
        return $this->makeRequest(__FUNCTION__, $request);
645
    }
646
647
    /**
648
     * Gets a client access token for a mail app for Outlook.
649
     *
650
     * @since Exchange 2013
651
     *
652
     * @param \jamesiarmes\PhpEws\Request\GetClientAccessTokenType $request
653
     * @return \jamesiarmes\PhpEws\Response\GetClientAccessTokenResponseType
654
     */
655
    public function GetClientAccessToken($request)
656
    {
657
        return $this->makeRequest(__FUNCTION__, $request);
658
    }
659
660
    /**
661
     * Retrieves one or more sets of items that are organized in to nodes in a
662
     * conversation.
663
     *
664
     * @since Exchange 2013
665
     *
666
     * @param \jamesiarmes\PhpEws\Request\GetConversationItemsType $request
667
     * @return \jamesiarmes\PhpEws\Response\GetConversationItemsResponseType
668
     */
669
    public function GetConversationItems($request)
670
    {
671
        return $this->makeRequest(__FUNCTION__, $request);
672
    }
673
674
    /**
675
     * Function Description
676
     *
677
     * @param \jamesiarmes\PhpEws\Request\GetDelegateType $request
678
     * @return \jamesiarmes\PhpEws\Response\GetDelegateResponseMessageType
679
     */
680
    public function GetDelegate($request)
681
    {
682
        return $this->makeRequest(__FUNCTION__, $request);
683
    }
684
685
    /**
686
     * Returns configuration information for in-place holds, saved discovery
687
     * searches, and the mailboxes that are enabled for discovery search.
688
     *
689
     * @since Exchange 2013
690
     *
691
     * @param \jamesiarmes\PhpEws\Request\GetDiscoverySearchConfigurationType $request
692
     * @return \jamesiarmes\PhpEws\Response\GetDiscoverySearchConfigurationResponseMessageType
693
     */
694
    public function GetDiscoverySearchConfiguration($request)
695
    {
696
        return $this->makeRequest(__FUNCTION__, $request);
697
    }
698
699
    /**
700
     * Function Description
701
     *
702
     * @param \jamesiarmes\PhpEws\Request\GetEventsType $request
703
     * @return \jamesiarmes\PhpEws\Response\GetEventsResponseType
704
     */
705
    public function GetEvents($request)
706
    {
707
        return $this->makeRequest(__FUNCTION__, $request);
708
    }
709
710
    /**
711
     * Function Description
712
     *
713
     * @param \jamesiarmes\PhpEws\Request\GetFolderType $request
714
     * @return \jamesiarmes\PhpEws\Response\GetFolderResponseType
715
     */
716
    public function GetFolder($request)
717
    {
718
        return $this->makeRequest(__FUNCTION__, $request);
719
    }
720
721
    /**
722
     * Retrieves the mailboxes that are under a specific hold and the associated
723
     * hold query.
724
     *
725
     * @since Exchange 2013
726
     *
727
     * @param \jamesiarmes\PhpEws\Request\GetHoldOnMailboxesType $request
728
     * @return \jamesiarmes\PhpEws\Response\GetHoldOnMailboxesResponseMessageType
729
     */
730
    public function GetHoldOnMailboxes($request)
731
    {
732
        return $this->makeRequest(__FUNCTION__, $request);
733
    }
734
735
    /**
736
     * Retrieves the list of instant messaging (IM) groups and IM contact
737
     * personas in a mailbox.
738
     *
739
     * @since Exchange 2013
740
     *
741
     * @param \jamesiarmes\PhpEws\Request\GetImItemListType $request
742
     * @return \jamesiarmes\PhpEws\Response\GetImItemListResponseMessageType
743
     */
744
    public function GetImItemList($request)
745
    {
746
        return $this->makeRequest(__FUNCTION__, $request);
747
    }
748
749
    /**
750
     * Retrieves information about instant messaging (IM) groups and IM contact
751
     * personas.
752
     *
753
     * @since Exchange 2013
754
     *
755
     * @param \jamesiarmes\PhpEws\Request\GetImItemsType $request
756
     * @return \jamesiarmes\PhpEws\Response\GetImItemsResponse
757
     */
758
    public function GetImItems($request)
759
    {
760
        return $this->makeRequest(__FUNCTION__, $request);
761
    }
762
763
    /**
764
     * Retrieves Inbox rules in the identified user's mailbox.
765
     *
766
     * @since Exchange 2010
767
     *
768
     * @param \jamesiarmes\PhpEws\Request\GetInboxRulesRequestType $request
769
     * @return \jamesiarmes\PhpEws\Response\GetInboxRulesResponseType
770
     */
771
    public function GetInboxRules($request)
772
    {
773
        return $this->makeRequest(__FUNCTION__, $request);
774
    }
775
776
    /**
777
     * Function Description
778
     *
779
     * @param \jamesiarmes\PhpEws\Request\GetItemType $request
780
     * @return \jamesiarmes\PhpEws\Response\GetItemResponseType
781
     */
782
    public function GetItem($request)
783
    {
784
        return $this->makeRequest(__FUNCTION__, $request);
785
    }
786
787
    /**
788
     * Retrieves the mail tips information for the specified mailbox.
789
     *
790
     * @since Exchange 2010
791
     *
792
     * @param \jamesiarmes\PhpEws\Request\GetMailTipsType $request
793
     * @return \jamesiarmes\PhpEws\Response\GetMailTipsResponseMessageType
794
     */
795
    public function GetMailTips($request)
796
    {
797
        return $this->makeRequest(__FUNCTION__, $request);
798
    }
799
800
    /**
801
     * Retrieves tracking information about the specified messages.
802
     *
803
     * @since Exchange 2010
804
     *
805
     * @param \jamesiarmes\PhpEws\Request\GetMessageTrackingReportRequestType $request
806
     * @return \jamesiarmes\PhpEws\Response\GetMessageTrackingReportResponseMessageType
807
     */
808
    public function GetMessageTrackingReport($request)
809
    {
810
        return $this->makeRequest(__FUNCTION__, $request);
811
    }
812
813
    /**
814
     * Retrieves details about items that cannot be indexed.
815
     *
816
     * This includes, but is not limited to, the item identifier, an error code,
817
     * an error description, when an attempt was made to index the item, and
818
     * additional information about the file.
819
     *
820
     * @since Exchange 2013
821
     *
822
     * @param \jamesiarmes\PhpEws\Request\GetNonIndexableItemDetailsType $request
823
     * @return \jamesiarmes\PhpEws\Response\GetNonIndexableItemDetailsResponseMessageType
824
     */
825
    public function GetNonIndexableItemDetails($request)
826
    {
827
        return $this->makeRequest(__FUNCTION__, $request);
828
    }
829
830
    /**
831
     * Retrieves the count of items that cannot be indexed in a mailbox.
832
     *
833
     * @since Exchange 2013
834
     *
835
     * @param \jamesiarmes\PhpEws\Request\GetNonIndexableItemStatisticsType $request
836
     * @return \jamesiarmes\PhpEws\Response\GetNonIndexableItemStatisticsResponseMessageType
837
     */
838
    public function GetNonIndexableItemStatistics($request)
839
    {
840
        return $this->makeRequest(__FUNCTION__, $request);
841
    }
842
843
    /**
844
     * Provides the email account password expiration date for the current user.
845
     *
846
     * @since Exchange 2010 SP2
847
     *
848
     * @param \jamesiarmes\PhpEws\Request\GetPasswordExpirationDateType $request
849
     * @return \jamesiarmes\PhpEws\Response\GetPasswordExpirationDateResponseMessageType
850
     */
851
    public function GetPasswordExpirationDate($request)
852
    {
853
        return $this->makeRequest(__FUNCTION__, $request);
854
    }
855
856
    /**
857
     * Retrieves a set of properties that are associated with a persona.
858
     *
859
     * @since Exchange 2013
860
     *
861
     * @param \jamesiarmes\PhpEws\Request\GetPersonaType $request
862
     * @return \jamesiarmes\PhpEws\Response\GetPersonaResponseMessageType
863
     */
864
    public function GetPersona($request)
865
    {
866
        return $this->makeRequest(__FUNCTION__, $request);
867
    }
868
869
    /**
870
     * Retrieve the timezones supported by the server.
871
     *
872
     * @since Exchange 2010
873
     *
874
     * @param \jamesiarmes\PhpEws\Request\GetServerTimeZonesType $request
875
     * @return \jamesiarmes\PhpEws\Response\GetServerTimeZonesResponseType
876
     */
877
    public function GetServerTimeZones($request)
878
    {
879
        return $this->makeRequest(__FUNCTION__, $request);
880
    }
881
882
    /**
883
     * Function Description
884
     *
885
     * @param \jamesiarmes\PhpEws\Request\GetUserAvailabilityRequestType $request
886
     * @return \jamesiarmes\PhpEws\Response\GetUserAvailabilityResponseType
887
     */
888
    public function GetUserAvailability($request)
889
    {
890
        return $this->makeRequest(__FUNCTION__, $request);
891
    }
892
893
    /**
894
     * Function Description
895
     *
896
     * @param \jamesiarmes\PhpEws\Request\GetUserOofSettingsRequest $request
897
     * @return \jamesiarmes\PhpEws\Response\GetUserOofSettingsResponse
898
     */
899
    public function GetUserOofSettings($request)
900
    {
901
        return $this->makeRequest(__FUNCTION__, $request);
902
    }
903
904
    /**
905
     * Function Description
906
     *
907
     * @param \jamesiarmes\PhpEws\Request\MoveFolderType $request
908
     * @return \jamesiarmes\PhpEws\Response\MoveFolderResponseType
909
     */
910
    public function MoveFolder($request)
911
    {
912
        return $this->makeRequest(__FUNCTION__, $request);
913
    }
914
915
    /**
916
     * Function Description
917
     *
918
     * @param \jamesiarmes\PhpEws\Request\MoveItemType $request
919
     * @return \jamesiarmes\PhpEws\Response\MoveItemResponseType
920
     */
921
    public function MoveItem($request)
922
    {
923
        return $this->makeRequest(__FUNCTION__, $request);
924
    }
925
926
    /**
927
     * Function Description
928
     *
929
     * @param \jamesiarmes\PhpEws\Request\RemoveDelegateType $request
930
     * @return \jamesiarmes\PhpEws\Response\RemoveDelegateResponseMessageType
931
     */
932
    public function RemoveDelegate($request)
933
    {
934
        return $this->makeRequest(__FUNCTION__, $request);
935
    }
936
937
    /**
938
     * Function Description
939
     *
940
     * @param \jamesiarmes\PhpEws\Request\ResolveNamesType $request
941
     * @return \jamesiarmes\PhpEws\Response\ResolveNamesResponseType
942
     */
943
    public function ResolveNames($request)
944
    {
945
        return $this->makeRequest(__FUNCTION__, $request);
946
    }
947
948
    /**
949
     * Function Description
950
     *
951
     * @param \jamesiarmes\PhpEws\Request\SendItemType $request
952
     * @return \jamesiarmes\PhpEws\Response\SendItemResponseType
953
     */
954
    public function SendItem($request)
955
    {
956
        return $this->makeRequest(__FUNCTION__, $request);
957
    }
958
959
    /**
960
     * Function Description
961
     *
962
     * @param \jamesiarmes\PhpEws\Request\SetUserOofSettingsRequest $request
963
     * @return \jamesiarmes\PhpEws\Response\SetUserOofSettingsResponse
964
     */
965
    public function SetUserOofSettings($request)
966
    {
967
        return $this->makeRequest(__FUNCTION__, $request);
968
    }
969
970
    /**
971
     * Function Description
972
     *
973
     * @param \jamesiarmes\PhpEws\Request\SubscribeType $request
974
     * @return \jamesiarmes\PhpEws\Response\SubscribeResponseType
975
     */
976
    public function Subscribe($request)
977
    {
978
        return $this->makeRequest(__FUNCTION__, $request);
979
    }
980
981
    /**
982
     * Function Description
983
     *
984
     * @param \jamesiarmes\PhpEws\Request\SyncFolderHierarchyType $request
985
     * @return \jamesiarmes\PhpEws\Response\SyncFolderHierarchyResponseType
986
     */
987
    public function SyncFolderHierarchy($request)
988
    {
989
        return $this->makeRequest(__FUNCTION__, $request);
990
    }
991
992
    /**
993
     * Function Description
994
     *
995
     * @param \jamesiarmes\PhpEws\Request\SyncFolderItemsType $request
996
     * @return \jamesiarmes\PhpEws\Response\SyncFolderItemsResponseType
997
     */
998
    public function SyncFolderItems($request)
999
    {
1000
        return $this->makeRequest(__FUNCTION__, $request);
1001
    }
1002
1003
    /**
1004
     * Function Description
1005
     *
1006
     * @param \jamesiarmes\PhpEws\Request\UnsubscribeType $request
1007
     * @return \jamesiarmes\PhpEws\Response\UnsubscribeResponseType
1008
     */
1009
    public function Unsubscribe($request)
1010
    {
1011
        return $this->makeRequest(__FUNCTION__, $request);
1012
    }
1013
1014
    /**
1015
     * Function Description
1016
     *
1017
     * @param \jamesiarmes\PhpEws\Request\UpdateDelegateType $request
1018
     * @return \jamesiarmes\PhpEws\Response\UpdateDelegateResponseMessageType
1019
     */
1020
    public function UpdateDelegate($request)
1021
    {
1022
        return $this->makeRequest(__FUNCTION__, $request);
1023
    }
1024
1025
    /**
1026
     * Function Description
1027
     *
1028
     * @param \jamesiarmes\PhpEws\Request\UpdateFolderType $request
1029
     * @return \jamesiarmes\PhpEws\Response\UpdateFolderResponseType
1030
     */
1031
    public function UpdateFolder($request)
1032
    {
1033
        return $this->makeRequest(__FUNCTION__, $request);
1034
    }
1035
1036
    /**
1037
     * Function Description
1038
     *
1039
     * @param \jamesiarmes\PhpEws\Request\UpdateItemType $request
1040
     * @return \jamesiarmes\PhpEws\Response\UpdateItemResponseType
1041
     */
1042
    public function UpdateItem($request)
1043
    {
1044
        return $this->makeRequest(__FUNCTION__, $request);
1045
    }
1046
1047
    /**
1048
     * Initializes the SoapClient object to make a request
1049
     *
1050
     * @return \jamesiarmes\PhpEws\SoapClient
1051
     *
1052
     * TODO: Build a class map that we can pass to the client.
1053
     */
1054
    protected function initializeSoapClient()
1055
    {
1056
        $this->soap = new SoapClient(
1057
            dirname(__FILE__) . '/assets/services.wsdl',
1058
            array(
1059
                'user' => $this->username,
1060
                'password' => $this->password,
1061
                'version' => $this->version,
1062
                'location' => 'https://' . $this->server . '/EWS/Exchange.asmx',
1063
                'impersonation' => $this->impersonation,
1064
            )
1065
        );
1066
1067
        return $this->soap;
1068
    }
1069
1070
    /**
1071
     * Makes the SOAP call for a request.
1072
     *
1073
     * @param string $operation
1074
     *   The operation to be called.
1075
     * @param \jamesiarmes\PhpEws\Request $request
1076
     *   The request object for the operation.
1077
     * @return \jamesiarmes\PhpEws\Response
1078
     *   The response object for the operation.
1079
     */
1080
    protected function makeRequest($operation, $request)
1081
    {
1082
        $this->initializeSoapClient();
1083
        $response = $this->soap->{$operation}($request);
1084
1085
        return $this->processResponse($response);
1086
    }
1087
1088
    /**
1089
     * Process a response to verify that it succeeded and take the appropriate
1090
     * action
1091
     *
1092
     * @throws \Exception
1093
     *
1094
     * @param \stdClass $response
1095
     * @return \stdClass
1096
     */
1097
    protected function processResponse($response)
1098
    {
1099
        // If the soap call failed then we need to throw an exception.
1100
        $code = $this->soap->getResponseCode();
1101
        if ($code != 200) {
1102
            throw new \Exception(
1103
                "SOAP client returned status of $code.",
1104
                $code
1105
            );
1106
        }
1107
1108
        return $response;
1109
    }
1110
}
1111