SharePoint REST API getFolderByServerRelativeUrl 不返回任何内容 [英] SharePoint REST API getFolderByServerRelativeUrl Returns Nothing

查看:29
本文介绍了SharePoint REST API getFolderByServerRelativeUrl 不返回任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想深入到库中,然后进入指定的文件夹,但我在让getFolderByServerRelativeUrl"为我抓取任何东西时遇到问题.

I would like to drill into the library and then into a specified folder, but I am having problems getting 'getFolderByServerRelativeUrl' to grab anything for me.

这个 http://_base/_api/web/getFolderByServerRelativeUrl('LibName')/files 返回零结果.但是如果我使用 http://_base/_api/web/lists/getbytitle('LibName')/items 它会返回多个项目.

This http://_base/_api/web/getFolderByServerRelativeUrl('LibName')/files returns zero results. But if I use http://_base/_api/web/lists/getbytitle('LibName')/items it returns multiple items.

推荐答案

/_api/web/lists/getbytitle('')/items 端点返回 all 列出库中的项目,/_api/web/getFolderByServerRelativeUrl('<url>')/files 仅返回位于(仅低于一级)下的文件指定的文件夹.

/_api/web/lists/getbytitle('<list title>')/items endpoint returns all list items within a library, /_api/web/getFolderByServerRelativeUrl('<url>')/files returns only files located under (one level beneath only) the specified folder.

示例

假设以下 Documents 库结构:

Assume the following Documents library structure:

Documents (library)
   |
   Guides (folder)
     |
     SharePoint User Guide.docx (file)

然后,以下请求:

/_api/web/lists/getbytitle('Documents')/items 将返回 2 个项目:

/_api/web/lists/getbytitle('Documents')/items will return 2 items:

  • Guides 文件夹关联的列表项
  • 与文件关联的列表项

同时请求:/_api/web/getFolderByServerRelativeUrl('Documents')/files

将返回 0 个文件,因为根文件夹中不包含任何文件

will returns 0 files since there are no files contained in the root folder

但是提供文件夹网址的请求:/_api/web/getFolderByServerRelativeUrl('Documents/Guides')/files

but the request with provided folder url: /_api/web/getFolderByServerRelativeUrl('Documents/Guides')/files

将返回 SharePoint User Guide.docx 文件.

这篇关于SharePoint REST API getFolderByServerRelativeUrl 不返回任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆