php - getItems 中的行数
问题描述
我试图使用 phpSPO 库从列表中获取所有项目:https ://github.com/vgrem/phpSPO
但是,在 Data 数组的 $remoteList 属性中,只有 100 行,并且列表有 100 多个项目。我看到这是一个常见问题,但是我不知道我应该为这个库考虑哪种解决方案。 https://sharepoint.stackexchange.com/questions/74777/list-api-get-all-items-limited-to-100-rows
$remoteList = $web->getLists()->getByTitle(xxx)
$listData = $remoteList->getItems();
解决方案
此文件中定义的CamlQuery
类有一个公共属性:ListItemCollectionPosition
这需要一个ListItemCollectionPosition
对象作为一个值:https ://github.com/vgrem/phpSPO/blob/b05be0eba6902dabd18784576bb6e1d55426fa99/src/SharePoint/ListItemCollectionPosition.php
所以我认为你的代码需要看起来像:
$remoteList = $web->getLists()->getByTitle(xxx);
$listItemCollectionPosition = new new ListItemCollectionPosition(); // Either add a use statement for this or use the fully qualified class name here
// ... (set the values according to the items/page you require)
$remoteList->ListItemCollectionPosition = $listItemCollectionPosition;
$listData = $remoteList->getItems();
关于如何准确使用它,请阅读此处的信息:
该示例使用 C# 编写,但并不难理解。
看起来好像您ListItemCollectionPosition
在查询上设置了以获取后续“页面”。看起来响应ListItemCollectionPosition
本身也包含一个属性,然后您可以将其用作下一个请求的起点。
推荐阅读
- java - IndexOutOfBoundsException:有两个 LinkedList
- db2 - 解码多列的最有效方法——DB2
- php - Woocommerce中的自定义结帐随机选择字段
- stripe-payments - 使用与信用卡相同的货币
- c++ - 我的代码在 for 循环之后没有执行任何操作
- javascript - 同步安装后节点找不到某些模块
- excel - 如果在列表中找到标签,则为产品总和
- sql-server - 在 SQL Server 中将列透视到行
- smtp - Acumatica - IT 团队想知道服务器的 IP,但它是 Saas 部署
- react-native - 立即反应导航返回上一个屏幕