phpSPO
phpSPO copied to clipboard
An uncaught Exception was encountered
An uncaught Exception was encountered Type: Error
Message: Call to a member function getSegment() on null
Filename: C:\wamp64\www\rest\vendor\vgrem\php-spo\src\Runtime\ClientObject.php
Line Number: 235
While executing CAML Query above error is coming
I am using below code
$list = $ctx->getWeb()->getLists()->getByTitle("Employees");
//$list = $ctx->getWeb()->getLists()->getByTitle("Tasks");
$qry = new CamlQuery();
$qry->ViewXml = "<View><Query><Where><Eq><FieldRef Name='ID'/><Value Type='Integer'>10</Value></Eq></Where></Query></View>";
$qry->ViewXml = '<View><Query><Where><Eq><FieldRef Name="ID"/><Value Type="Integer">10</Value></Eq></Where></Query></View>';
$items = $list->getItems($qry);
$ctx->load($items);
$ctx->executeQuery();
foreach ($items as $index => $item){
print($index . ":" . $item->getProperty('ID') . PHP_EOL);
print($index . ":" . $item->getProperty('FirstName') . PHP_EOL);
}`
Also tried for <Value Type='Text'> and <Value Type='Number'> as mention here
Its giving blank screen when search value put like <Value Type='Integer'><10></Value>
It's very interesting how completely incorrect CAML could lead to a failing request? :D CAML is XML with a specific schema.
@koltyakov, Sorry for posted question, code was not warped inside
$qry->ViewXml = '<View><Query><Where><Eq><FieldRef Name="ID"/><Value Type="Integer">10</Value></Eq></Where></Query></View>';
to
$qry->ViewXml = '10'; now i edited it.
Hi there, Is there any method available through that I could get Sharepoint list row by ID? Please let me know if it is possible in other ways. I am using Sharepoint 2016.