前言
说来话长,也有点儿惭愧(又惭愧,不要再提了,赶紧进入主题吧),哈哈,根据近期对SharePoint list或document library数据的操作,今天抽出一点点儿时间,给大伙儿整理一下获取list或document library数据的不同方式,同时也会对不同的方法对于处理SharePoint列表数据超过阈值范围后是否支持给与说明
若内容中有错误,烦请大家及时指出,多谢了,哈哈
获取数据不同方法
1、PNP SP JS
说明:
- 该请求每次返回2000数据,如果列表数据超过2000,则会自动分为多次进行请求,等全部请求完成后一次性返回所有数据
- 如果列表数据已经超过阈值,如果filter中有不为索引的列,则会报错(如果要保证不报错,可以不加任何条件一次性返回所有数据,然后对结果进行filter筛选操作,但是性能可能会降低)
var searchStr = '搜索关键字';
pnp.sp.web.lists
.getByTitle('list or document title')
.items
.select('FSObjType', 'ContentTypeId', 'ContentType', 'FileLeafRef', 'FileRef').expand('File', 'File/Properties')
.filter("substringof('" + searchStr + "',FileLeafRef) and FSObjType eq 0")//FSObjType 0为文件 1为文件夹
.getAll().then(function (data) {
console.log(data.length);
});
2、SharePoint plus js
说明
- rowlimit:单次请求最多可以返回5000条数据,如果超过5000条数据,则执行多次请求,然后一次性返回,且每次请求时会执行方法progress
- paging:设置是否分页,如果超过5000条数据,需要设置为true
- folderOptions:
-
options.folderOptions.path 可选, 默认值: ""
Relative path of the folders we want to explore (by default it's the root of the document library)
-
options.folderOptions.show 可选, 默认值: "FilesAndFolders_InFolder"
-
"FilesOnly_Recursive" :that lists all the files recursively from the provided path (and its children);
-
"FilesAndFolders_Recursive" that lists all the files and folders recursively from the provided path (and its children);
-
"FilesOnly_InFolder" that lists all the files from the provided path;
<
-
-