You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the latest version of 3.1.1 and SharePoint online.
The only working snippet I got using this library is below - I can retrieve the root list of lists, any other command returns an empty list.
$credentials = new \Office365\Runtime\Auth\UserCredentials("USERNAME", "PASSWORD");
$ctx = (new \Office365\SharePoint\ClientContext("URL"))->withCredentials($credentials);
foreach ($ctx->getWeb()->getLists()->get()->executeQuery() as $list) {
dump($list->getId() . ' ' . $list->getTitle());
}
I tweaked the code above to return all items from the Documents list but it always returns an empty list.
$credentials = new \Office365\Runtime\Auth\UserCredentials("USERNAME", "PASSWORD");
$ctx = (new \Office365\SharePoint\ClientContext("URL"))->withCredentials($credentials);
foreach ($ctx->getWeb()->getLists()->get()->executeQuery() as $list) {
if($list->getTitle() === 'Documents') {
$listItems = $list->getItems()->get()->executeQuery();
//RETURNS EMPTY LIST OF ITEMS
foreach ($listItems as $item){
dump($item->getTitle());
}
}
}
I tried other different ways as well, e.g.
$credentials = new \Office365\Runtime\Auth\UserCredentials("USERNAME", "PASSWORD");
$ctx = (new \Office365\SharePoint\ClientContext("URL"))->withCredentials($credentials);
$list = $ctx->getWeb()->getList("Shared Documents")->executeQuery();
$listItems = $list->getItems()->get()->executeQuery();
//SAME ISSUE, THE LIST IS EMPTY
foreach ($listItems as $item){
dump($item->getTitle());
}
I have read and edit permissions for the whole project.
Any suggestions?
The text was updated successfully, but these errors were encountered:
I am using the latest version of 3.1.1 and SharePoint online.
The only working snippet I got using this library is below - I can retrieve the root list of lists, any other command returns an empty list.
I tweaked the code above to return all items from the Documents list but it always returns an empty list.
I tried other different ways as well, e.g.
I have read and edit permissions for the whole project.
Any suggestions?
The text was updated successfully, but these errors were encountered: