Skip to content

Read items from sharepoint #292

@BeginnerRaffe

Description

@BeginnerRaffe

Hello,

I have read that are some issues to read may items from sharepoint? I have tested with 500 and it seams to work for me. Are there any limitations how many items you can read?

I would like to make a query when I read from sharepoint. I got a date field in my sharepoint list and I would like only to read the items that is newer than a specific date. It that possible? (My sharepoint lits will contain many items ...)

I use the code below:

use Office365\SharePoint\ClientContext;
use Office365\Runtime\Auth\ClientCredential;
use Office365\SharePoint\ListItem;

$credentials = new ClientCredential("{client-id}", "{client-secret}");
$client = (new ClientContext("https://{your-tenant-prefix}.sharepoint.com"))->withCredentials($credentials);

$web = $client->getWeb();
$list = $web->getLists()->getByTitle("{list-title}"); //init List resource
$items = $list->getItems(); //prepare a query to retrieve from the. How do I make q query here?
$client->load($items); //save a query to retrieve list items from the server
$client->executeQuery(); //submit query to SharePoint server
/** @var ListItem $item */
foreach($items as $item) {
print "Task: {$item->getProperty('Title')}\r\n";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions