SharePoint 2013 CAML查询以在XSLT列表视图Web部件中显示子文件夹 [英] SharePoint 2013 CAML Query to Show Subfolders in XSLT List View Web Part

查看:72
本文介绍了SharePoint 2013 CAML查询以在XSLT列表视图Web部件中显示子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DL ). 我在文档库中有一个名为DocumentStatus的字段,并且只有DocumentStatus被批准"的文档才会显示在列表视图中.

I am currently working with a custom web part and SharePoint 2013 XSLTListViewWebPart to show documents inside a document library (lets call it DL). I have a field called DocumentStatus inside the document library, and only documents whose DocumentStatus are 'Approved' will show up in the list view.

我还有另一个名为SubFolderUrl的字段,它将使用工作流生成,并包含文件夹的相对URL(如果将文件夹添加到文档库中).

I also have another field called SubFolderUrl, which will be generated using workflow, and contains the relative URL of a folder (if a folder is added to the document library).

列表视图在文档库的根级别和第一个文件夹级别上都很好用.但是,当用户添加子文件夹时(我们称其为 X ),然后是X内部的文件夹(其中 应该为Y)不会显示在列表视图Web部件上(尽管X内的文件可以正确显示).

The list view works great on the root level and the first folder level of the document library. However, when a user adds a subfolder (lets call it Y) inside a folder (lets call it X), then the folders inside X (which should be Y) are not displayed on the list view web part (the files inside X are displayed correctly though).

这是我扔到列表视图中的CAML查询:

Here is the CAML query I've thrown into the list view:

<View Scope='All' Name='MyViewName'>
<Query>
<OrderBy>
    <FieldRef Name='Created' Ascending='FALSE' />
</OrderBy>
<Where>
    <And>
        <Eq>
            <FieldRef Name='DocumentStatus' />
            <Value Type='Choice'>Approved</Value>
        </Eq>
        <Eq>
             <FieldRef Name='FileDirRef' />
             <Value Type='Lookup'>DL/X/Y</Value>
        </Eq>
    </And>
</Where>
</Query>
<RowLimit Paged='TRUE'>30</RowLimit>
<Aggregations Value='OFF' />
<Toolbar Type='None' />
</View>

First I thought it has something to do with the scope. But when I tried to change the scope from All to Recursive, it returned nothing. When I changed the scope to RecursiveAll, it returned folders and files inside those folders in 1 level (which is not what I expected).

对我在这里做错的任何想法吗?

Any ideas on what I am doing wrong here?

推荐答案

您是否只想检索文件而不是文件和文件夹?

https://msdn. microsoft.com/en-us/library/microsoft.sharepoint.spviewscope.aspx

您可以尝试删除FileDirRef来检查是否是由这种情况引起的.

根据我的测试,我可以获得通过递归映射到条件的文件(Folder1/Y1).

给您的提示:

您可以使用CAML Designer 2013帮助您构建CAML查询.

最好的问候,


这篇关于SharePoint 2013 CAML查询以在XSLT列表视图Web部件中显示子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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