-
-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathListCollection.php
70 lines (61 loc) · 1.68 KB
/
ListCollection.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Office365\SharePoint;
use Office365\Runtime\Actions\InvokePostMethodQuery;
use Office365\Runtime\ClientObject;
use Office365\Runtime\ClientRuntimeContext;
use Office365\Runtime\Paths\ServiceOperationPath;
use Office365\Runtime\ResourcePath;
/**
* List collection
*/
class ListCollection extends BaseEntityCollection
{
public function __construct(ClientRuntimeContext $ctx, ?ResourcePath $resourcePath = null, ?ClientObject $parent = null)
{
parent::__construct($ctx, $resourcePath, SPList::class , $parent);
}
/**
* Get List by title
* @param $title
* @return SPList
*/
public function getByTitle($title)
{
return new SPList(
$this->getContext(),
new ServiceOperationPath("getByTitle",array(rawurlencode($title)),$this->getResourcePath())
);
}
/**
* Get List by id
* @param $id
* @return SPList
*/
public function getById($id)
{
return new SPList(
$this->getContext(),
new ServiceOperationPath("getById",array($id),$this->getResourcePath())
);
}
/**
* Creates a List resource
* @param ListCreationInformation $properties
* @return SPList
*/
public function add(ListCreationInformation $properties)
{
$list = new SPList($this->getContext());
$qry = new InvokePostMethodQuery($this,null,null,null,$properties);
$this->getContext()->addQueryAndResultObject($qry,$list);
$this->addChild($list);
return $list;
}
/**
* @return string
*/
public function getItemTypeName()
{
return __NAMESPACE__ . "\\" . "SPList";
}
}