-
Notifications
You must be signed in to change notification settings - Fork 4
/
Tasks.php
44 lines (34 loc) · 1.63 KB
/
Tasks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace amirsanni\phpewswrapper;
use amirsanni\phpewswrapper\Folders;
use jamesiarmes\PhpEws\Enumeration\ResponseClassType;
use jamesiarmes\PhpEws\Enumeration\DistinguishedFolderIdNameType;
class Tasks{
public $limit;
private $folder;
public function __construct($ews){
$this->folder = new Folders($ews);
}
/*
********************************************************************************************************************************
********************************************************************************************************************************
********************************************************************************************************************************
********************************************************************************************************************************
********************************************************************************************************************************
*/
public function get(int $page_number=1){
$response = $this->folder->getItems($page_number, DistinguishedFolderIdNameType::TASKS, $this->limit);
$res = new \stdClass();
if($response[0]->ResponseClass == ResponseClassType::SUCCESS){
//format the response by returning specific fields
$retrieved_tasks = $response[0]->RootFolder->Items->Task;
$res->tasks = $retrieved_tasks;
$res->status = 1;
}
else{
$res->msg = $response[0]->ResponseCode.": ".$response[0]->MessageText;
$res->status = 0;
}
return $res;
}
}