Skip to content

Commit 6ee4b2c

Browse files
committed
#314: examples to filter list items
1 parent f9fe61f commit 6ee4b2c

7 files changed

Lines changed: 112 additions & 4 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
require_once '../../vendor/autoload.php';
4+
$settings = include('../../../tests/Settings.php');
5+
6+
7+
use Office365\Runtime\Auth\ClientCredential;
8+
use Office365\SharePoint\CamlQuery;
9+
use Office365\SharePoint\ClientContext;
10+
use Office365\SharePoint\ListItem;
11+
12+
$credentials = new ClientCredential($settings['ClientId'], $settings['ClientSecret']);
13+
$siteUrl = $settings['TeamSiteUrl'];
14+
$ctx = (new ClientContext($siteUrl))->withCredentials($credentials);
15+
16+
$list = $ctx->getWeb()->getLists()->getByTitle("Documents");
17+
18+
$qry = new CamlQuery();
19+
$qry->ViewXml = <<<XML
20+
<View Scope='RecursiveAll'>
21+
<Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">Updated</Value></Eq></Where></Query>
22+
</View>
23+
XML;
24+
$items = $list->getItems($qry)->executeQuery();
25+
26+
/** @var ListItem $item */
27+
foreach ($items as $item){
28+
print($item->getProperty('Title') . PHP_EOL);
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
require_once '../../vendor/autoload.php';
4+
$settings = include('../../../tests/Settings.php');
5+
6+
7+
use Office365\Runtime\Auth\ClientCredential;
8+
use Office365\SharePoint\ClientContext;
9+
use Office365\SharePoint\ListItem;
10+
11+
$credentials = new ClientCredential($settings['ClientId'], $settings['ClientSecret']);
12+
$siteUrl = $settings['TeamSiteUrl'];
13+
$ctx = (new ClientContext($siteUrl))->withCredentials($credentials);
14+
15+
$list = $ctx->getWeb()->getLists()->getByTitle("Documents");
16+
$items = $list->getItems()->select(["Title"])->filter("Title eq 'Updated'")->get()->executeQuery();
17+
/** @var ListItem $item */
18+
foreach ($items as $item){
19+
print($item->getProperty('Title') . PHP_EOL);
20+
}

src/SharePoint/SPList.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated 2023-09-30T09:13:50+00:00 16.0.24106.12014
4+
* Generated 2023-10-01T08:17:31+00:00 16.0.24106.12014
55
*/
66
namespace Office365\SharePoint;
77

@@ -1665,4 +1665,11 @@ public function setSensitivityLabelToEncryptOnDOwnloadForLibrary($value)
16651665
{
16661666
return $this->setProperty("SensitivityLabelToEncryptOnDOwnloadForLibrary", $value, true);
16671667
}
1668+
/**
1669+
* @return VersionPolicyManager
1670+
*/
1671+
public function getVersionPolicies()
1672+
{
1673+
return $this->getProperty("VersionPolicies", new VersionPolicyManager($this->getContext(), new ResourcePath("VersionPolicies", $this->getResourcePath())));
1674+
}
16681675
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Office365\SharePoint\Sharing;
4+
5+
use Office365\Runtime\ClientValue;
6+
7+
class RecipientLimits extends ClientValue
8+
{
9+
10+
}

src/SharePoint/Sharing/SharingInformation.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated 2023-09-30T09:13:50+00:00 16.0.24106.12014
4+
* Generated 2023-10-01T08:17:31+00:00 16.0.24106.12014
55
*/
66
namespace Office365\SharePoint\Sharing;
77

@@ -823,4 +823,18 @@ public function settenantId($value)
823823
{
824824
return $this->setProperty("tenantId", $value, true);
825825
}
826+
/**
827+
* @return RecipientLimits
828+
*/
829+
public function getrecipientLimits()
830+
{
831+
return $this->getProperty("recipientLimits");
832+
}
833+
/**
834+
* @var RecipientLimits
835+
*/
836+
public function setrecipientLimits($value)
837+
{
838+
return $this->setProperty("recipientLimits", $value, true);
839+
}
826840
}

src/SharePoint/Site.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* This file was generated by phpSPO model generator 2022-04-22T09:37:05+03:00 16.0.22406.12004
4+
* Generated 2023-10-01T08:17:31+00:00 16.0.24106.12014
55
*/
66
namespace Office365\SharePoint;
77

@@ -1425,4 +1425,25 @@ public function setWriteLocked($value)
14251425
{
14261426
return $this->setProperty("WriteLocked", $value, true);
14271427
}
1428+
/**
1429+
* @return HTMLFieldSecuritySetting
1430+
*/
1431+
public function getAllowedExternalDomains()
1432+
{
1433+
return $this->getProperty("AllowedExternalDomains");
1434+
}
1435+
/**
1436+
* @var HTMLFieldSecuritySetting
1437+
*/
1438+
public function setAllowedExternalDomains($value)
1439+
{
1440+
return $this->setProperty("AllowedExternalDomains", $value, true);
1441+
}
1442+
/**
1443+
* @return SiteVersionPolicyManager
1444+
*/
1445+
public function getVersionPolicyForNewLibrariesTemplate()
1446+
{
1447+
return $this->getProperty("VersionPolicyForNewLibrariesTemplate", new SiteVersionPolicyManager($this->getContext(), new ResourcePath("VersionPolicyForNewLibrariesTemplate", $this->getResourcePath())));
1448+
}
14281449
}

src/SharePoint/SiteVersionPolicyManager.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated 2023-09-30T09:13:50+00:00 16.0.24106.12014
4+
* Generated 2023-10-01T08:17:31+00:00 16.0.24106.12014
55
*/
66
namespace Office365\SharePoint;
77

@@ -25,4 +25,11 @@ public function setMajorVersionLimit($value)
2525
{
2626
return $this->setProperty("MajorVersionLimit", $value, true);
2727
}
28+
/**
29+
* @return VersionPolicyManager
30+
*/
31+
public function getVersionPolicies()
32+
{
33+
return $this->getProperty("VersionPolicies", new VersionPolicyManager($this->getContext(), new ResourcePath("VersionPolicies", $this->getResourcePath())));
34+
}
2835
}

0 commit comments

Comments
 (0)