实施OR后,CAML查询失败

问题描述 投票:-1回答:1

在我的SharePoint CAML查询中,当使用一个输入进行筛选时,它是成功的。但是,当我添加<Or>以包含另一个输入时,它失败了。

下面是CAML查询。错误是由于多输入格式错误引起的吗?


单输入(通过)

<Where>
    <And>
        <Eq>
            <FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
        </Eq>
            <Neq><FieldRef Name ="ContentType"/><Value Type="Text">"Document"</Value></Neq>
    </And>
</Where>

多次输入(失败)

<Where>
    <And>
        <Eq>
            <Or>
                <FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
                <FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value>
            </Or>
        </Eq>
            <Neq><FieldRef Name ="ContentType"/><Value Type="Text">"Document"</Value></Neq>
    </And>
</Where>

错误:

没有正确安装一个或多个字段类型。前往清单设置页面删除这些字段。在Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)在Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClientpSqlClient,字符串bstrUrl,字符串bstrListName,字符串bstrViewName,字符串bstrViewXml,SAFEARRAYFLAGS fSafeArrayFlags,ISP2DSafeArrayWriter pSACallback,ISPDataCallback pPagingCallback,ISPDataCallback pPagingPrevCallback,ISPDataCallbackpFilterLinkCallback,ISPDataCallback pSchemaCallback,ISPDataCallbackpRowCountCallback,Boolean&pbMaximalView)Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()在Microsoft.SharePoint.SPListItemCollection.get_Count()

sharepoint caml
1个回答
0
投票
<Where> <And> <Or> <Eq> <FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value> </Eq> <Eq><FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value> </Eq> </Or> <Neq><FieldRef Name ="ContentType"/><Value Type="Text">"Document"</Value></Neq> </And> </Where>
© www.soinside.com 2019 - 2024. All rights reserved.