Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么或元素无法在Sharepoint中检索项目_C#_Sharepoint - Fatal编程技术网

C# 为什么或元素无法在Sharepoint中检索项目

C# 为什么或元素无法在Sharepoint中检索项目,c#,sharepoint,C#,Sharepoint,我需要从sharepoint列表中获取特定的项目列表 这是我的工作代码(适用于或元素下的两种情况): XmlDocument xmlDoc=new System.Xml.XmlDocument(); XmlNode ndViewFields=xmlDoc.CreateNode(XmlNodeType.Element,“ViewFields”和“”); XmlNode ndQueryOptions=xmlDoc.CreateNode(XmlNodeType.Element,“QueryOption

我需要从sharepoint列表中获取特定的项目列表

这是我的工作代码(适用于或元素下的两种情况):

XmlDocument xmlDoc=new System.Xml.XmlDocument();
XmlNode ndViewFields=xmlDoc.CreateNode(XmlNodeType.Element,“ViewFields”和“”);
XmlNode ndQueryOptions=xmlDoc.CreateNode(XmlNodeType.Element,“QueryOptions”和“”);
XmlNode ndQuery=xmlDoc.CreateNode(XmlNodeType.Element,“Query”,“”);
ndQueryOptions.InnerXml=“FALSE”+“TRUE”;
ndViewFields.InnerXml=@;
ndQuery.InnerXml=“Title1Title2”;
尝试
{
XmlNode ndListItems=ListsService.GetListItems(sharepointList,null,ndQuery,ndViewFields,null,ndQueryOptions,null);
Show(ndListItems.OuterXml);
}
捕获(例外情况除外)
{
Console.WriteLine(例如ToString());
}
但是,如果OR元素下的查询项超过2,那么假设我们有3个。它将失败并返回500个内部服务器错误

ndQuery.InnerXml = "<Where><Or><Eq><FieldRef Name='Title'/><Value Type='Text'>Title1</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>Title2</Value></Eq><Eq><FieldRef Name='Title'/><Value Type='Text'>Title3</Value></Eq></Or></Where>";
ndQuery.InnerXml=“Title1Title2Title3”;
我不知道我哪里出错了,因为如果我把它弄坏了,我看不出有什么问题

有什么想法吗?

或者只能有两个子节点。如果要将一个或三个条件组合在一起,则需要将其中一个或两个条件组合在一起,然后将该节点与另一个条件组合在一起


标题1
标题2
标题3
或只能有两个子节点。如果要将一个或三个条件组合在一起,则需要将其中一个或两个条件组合在一起,然后将该节点与另一个条件组合在一起


标题1
标题2
标题3

CAML查询最多可以包含两条比较语句或块

所以在您的案例中,CAML查询应该是这样的

 <Where>
      <Or>
         <Or>
            <Eq><condition></Eq>
            <Eq><condition></Eq>
         </Or>
         <Eq><condition></Eq>
      </Or>
</Where>

CAML查询最多可以包含两条比较语句或块

所以在您的案例中,CAML查询应该是这样的

 <Where>
      <Or>
         <Or>
            <Eq><condition></Eq>
            <Eq><condition></Eq>
         </Or>
         <Eq><condition></Eq>
      </Or>
</Where>


您能否举例说明如何操作?(最好使用我的示例ndQuery.InnerXml=“…作为基础)我得到了它,但这是我实现它的方式。您能否给出一个如何实现它的示例?(最好使用我的示例ndQuery.InnerXml=“…作为基础)我得到了它,但这是我实现它的方式。