gpt4 book ai didi

sharepoint - 使用 SPServices 显示文档库中单个子文件夹的内容

转载 作者:行者123 更新时间:2023-12-02 20:25:36 26 4
gpt4 key购买 nike

在 SharePoint 中并使用 SPServices,我尝试查看文档库的特定子文件夹的文件夹内容(而不是库内的每个文件和文件夹)。库结构如下所示:

列表名称:共享文档

  • 文件夹 #1
    • 子文件夹#4
      • 文件#6
      • 文件 #7
    • 子文件夹 #5
      • 文件#8
    • 文件 #9
  • 文件夹 #2
  • 文件夹 #3

使用 GetListItems 列出顶级文件夹非常容易,但我想让用户单击其中一个文件夹并仅列出子文件夹的直接子文件夹。

因此,如果有人点击“Folder #1”,那么我只想向他们显示以下内容:

  • 文件夹 #4
  • 文件夹 #5
  • 文件 #9

我完全不知道如何列出特定子文件夹的直接子文件夹。

有人可以帮忙吗?

最佳答案

为了限制对特定文件夹的查询,可以指定具有 Folder 值的 CAMLQueryOptions 参数:

<QueryOptions>
<Folder>/SiteName/Lists/Links/folder/subFolder</Folder>
</QueryOptions>

示例

var listName = "Shared Documents";
var folderName = "/Shared Documents/Folder #1";

$().SPServices({
operation: "GetListItems",
async: false,
listName: listName,
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
CAMLQueryOptions: "<QueryOptions><Folder>" + folderName + "</Folder></QueryOptions>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var title = $(this).attr("ows_Title");
console.log(title);
});
}
});

请关注this thread了解更多详情。

关于sharepoint - 使用 SPServices 显示文档库中单个子文件夹的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24328532/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com