使用 SPSiteDataQuery 按站点名称和列表名称过滤项目
我使用以下代码列出多个文件夹中的文件:
SPSiteDataQuery q = new SPSiteDataQuery();
q.Lists = "<Lists BaseType='1'/>";
q.Query = "<Where> <Where>
<And><Neq><FieldRef Name='FSObjType'/><Value Type='Lookup'>1</Value></Neq>
<Contains><FieldRef Name='ProjectProperty.Title' /><Value Type='Text'>Site_Name_Value_From_TextBox</Value></Contains>
</And>
</Where></Where>";
q.Webs = "<Webs Scope='Recursive' />";
q.ViewFields = "<FieldRef Name='ID' /><FieldRef Name='LinkFilename' /><FieldRef Name='File_x0020_Type' /><FieldRef Name='Title' /><FieldRef Name='FileRef' /><ListProperty Name='Title' /><ProjectProperty Name='Title' />";
该代码对于列出项目工作正常,但我需要按站点名称和库名称过滤项目,我使用
但当我使用 Title 或FileRef 或任何其他字段过滤器工作正常,我应该使用什么来代替“ProjectProperty”和“ListProperty”?
I am listing files from multiple folders using the below code:
SPSiteDataQuery q = new SPSiteDataQuery();
q.Lists = "<Lists BaseType='1'/>";
q.Query = "<Where> <Where>
<And><Neq><FieldRef Name='FSObjType'/><Value Type='Lookup'>1</Value></Neq>
<Contains><FieldRef Name='ProjectProperty.Title' /><Value Type='Text'>Site_Name_Value_From_TextBox</Value></Contains>
</And>
</Where></Where>";
q.Webs = "<Webs Scope='Recursive' />";
q.ViewFields = "<FieldRef Name='ID' /><FieldRef Name='LinkFilename' /><FieldRef Name='File_x0020_Type' /><FieldRef Name='Title' /><FieldRef Name='FileRef' /><ListProperty Name='Title' /><ProjectProperty Name='Title' />";
the code is working fine for listing items, but i need to filter items by Site name and Library Name, i used
<Contains><FieldRef Name='ProjectProperty.Title' /><Value Type='Text'>Site_NAme</Value></Contains>
but i get no results, when i use Title or FileRef or any other field filter is working fine, what should i use instead of "ProjectProperty" and "ListProperty "??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
或
Try
or