【SharePoint】获取SharePoint列表或文档库数据的方法汇总(pnp sp js、SharePoint plus js、rest api 、caml),以及列表或文档库数据超过阈值后查询

前言

说来话长,也有点儿惭愧(又惭愧,不要再提了,赶紧进入主题吧),哈哈,根据近期对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;

        <
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一起来学吧

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值