简体   繁体   English

为什么查询失败时SharePoint客户端对象模型会检索所有项目?

[英]Why SharePoint client object model retrieves all items when query fails?

I'm trying to get the items from a child list (a lookup list i suppose, i'm new in SharePoint development) that are related to their items in the parent list. 我正在尝试从子列表(我想是查找列表,我是SharePoint开发中的新手)中获取与其父列表中的项目相关的项目。 For brevity, lets call them list A for parent and list B for child. 为简便起见,让我们将其称为父级列表A和子级列表B。 So in general, list A has at most 4 to 5 child items from list B, and it can sometimes have no item from B at all. 因此,通常,列表A最多具有列表B的4到5个子项,有时列表B可能根本没有任何项。 I'm using the amazingly useful Camlex.Net library for creating the caml queries. 我正在使用非常有用的Camlex.Net库来创建caml查询。 This is the caml that i'm creating via camlex, very basic: 这是我通过camlex创建的caml,非常基本:

<Query>
  <Where>
    <Eq>
      <FieldRef Name="VisitSummary" LookupId="True" />
      <Value Type="Lookup">1</Value>
    </Eq>
  </Where>
</Query>

The problem is that when item 1 in list A (like in the xml above) doesn't have items in list B, so SharePoint returns all the items in list B, which is not desirable at all. 问题在于,当列表A中的项目1(如上面的xml中的项目)在列表B中没有项目时,SharePoint将返回列表B中的所有项目,这是完全不希望的。 When list A does have child items in B, it works well, it gets only the related items. 当列表A在B中确实有子项时,它运作良好,它仅获取相关项。
Is there a way to tell SharePoint to return some other value, perhaps null or whatever instead of all the items in the child list? 有没有一种方法可以告诉SharePoint返回一些其他值(可能为null或其他值)而不是子列表中的所有项目?

thanks, 谢谢,
ashilon ashilon

You must surrond the query with the <view> tag. 您必须使用<view>标记替代查询。

See this question on stackoverflow and this on stackexchange 请参阅关于stackoverflow的问题以及关于stackexchange的问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SharePoint使用客户端对象模型(COM)枚举所有托管路径 - SharePoint enumerating all managed paths using the Client Object Model (COM) Sharepoint客户端对象模型区域设置 - Sharepoint Client Object Model locale 如何使用List.asmx本机WebService和客户端对象模型将新项目添加到SharePoint列表? - How to add new items to SharePoint List using List.asmx native WebService and client object model? Sharepoint客户端对象模型设置ModifiedBy字段 - Sharepoint Client Object Model setting ModifiedBy field SharePoint客户端对象模型中的“编码”登录名 - “Encoded” login names in SharePoint Client Object Model 使用LINQ to SharePoint通过针对PeoplePicker的lambda表达式进行查询-客户端对象模型 - Query using LINQ to SharePoint with lambda expression against PeoplePicker - client object model 使用Sharepoint 2010客户端对象模型搜索站点中以特定扩展名结尾的所有文档 - Search for all documents in a site that end with a specific extention using Sharepoint 2010 Client Object Model 当我尝试使用SharePoint Client Object Model和.NET应用程序在线连接共享点时出现“提供了无效的参数”错误 - “An invalid argument was supplied” error when I try to connect sharepoint online using SharePoint Client Object Model with .NET application 通过客户端对象模型在SharePoint中重命名文件时,如果两者之间有一个点,则会修剪文件名 - When renaming a file in SharePoint via client object model, the filename gets trimmed if there's a dot in between Sharepoint 2010客户端对象模型从网址获取列表项 - Sharepoint 2010 Client Object Model get a List item from a Url
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM