1

I have a strange problem with a CAML-Query in SharePoint 2016 when using the Contains-Element.

This is the query:

<View>
    <Query>
        <Where>
            <And>
                <Contains>
                    <FieldRef Name='Title'/>
                    <Value Type='Text'>te</Value>
                </Contains>
                <Neq>
                    <FieldRef Name='Lookupable'/>
                    <Value Type='Boolean'>0</Value>
                </Neq>
                <Eq>
                    <FieldRef Name='Testcriteria'/>
                    <Value Type='Number'>1</Value>
                </Eq>
            </And>
        </Where>
    </Query>
</View>

It looks valid to me, but when executing it via JSOM it gives me the errors in the ULS-Log, you can see below. If I remove the Contains-Element, it works fine. It also works, when I remove the "Lookupable"- and "Testcriteria"-Blocks (and the And-Element, of course).

Any ideas?

Sebastian


ULS-Log:

Entering Monitored Scope (VqueryEngine). Parent=SPRequest.GetListItemDataWithCallback2

OriginalPermissionMask check failed for {967862DE-F9DC-4ACC-A778-4A39C03D34A1}. Asking for 0x00000005, have 0x2000011001

OriginalPermissionMask check failed for {967862DE-F9DC-4ACC-A778-4A39C03D34A1}. Asking for 0x00000015, have 0x2000011001

PermissionMask check failed for {967862DE-F9DC-4ACC-A778-4A39C03D34A1}. Asking for 0x00000041, have 0x2000011001

Unable to execute query: Error 0x80004005

Leaving Monitored Scope: (VqueryEngine) Execution Time=3.2016; CPU Milliseconds=2; SQL Query Count=1; Parent=SPRequest.GetListItemDataWithCallback2

Der Vorgang kann nicht erfolgreich beendet werden. Bitte versuchen Sie es erneut.

SPRequest.GetListItemDataWithCallback2: UserPrincipalName=i:0).w|s-1-5-21-1458265474-2686932499-2065888148-2620, AppPrincipalName= ,pSqlClient= ,bstrUrl=https://intranet.xyz123.com/dev ,bstrListName={22463C43-6E4B-449D-8EF9-D05DC09FB370} ,bstrViewName= ,bstrViewXml=te01 ,fSafeArrayFlags=SAFEARRAYFLAG_DATES_IN_UTC

System.Runtime.InteropServices.COMException: Der Vorgang kann nicht erfolgreich beendet werden. Bitte versuchen Sie es erneut., StackTrace: bei Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() bei Microsoft.SharePoint.ServerStub.SPListItemCollectionServerStub.WritePropertiesAsJson(JsonWriter writer, Object target, ProxyContext proxyContext) bei Microsoft.SharePoint.Client.ServerStub.WriteAsJson(JsonWriter writer, Object obj, ClientObjectQuery objectQuery, ProxyContext proxyContext) bei Microsoft.SharePoint.Client.ServerStub.WriteAsJsonWithMonitoredScope(JsonWriter writer, Object value, ClientObjectQuery objectQuery, ProxyContext proxyContext, MonitoredScopeType scopeType) bei Microsoft.SharePoint.Client.ClientMethodsProcessor.WriteQueryResults(Object obj, ClientObjectQuery objQuery) bei Microsoft.SharePoint.Client.ClientMethodsProcessor.ProcessQuery(XmlElement xe) bei Microsoft.SharePoint.Client.ClientMethodsProcessor.ProcessStatements(XmlNode xe) bei Microsoft.SharePoint.Client.ClientMethodsProcessor.Process() bei Microsoft.SharePoint.Client.ClientRequestServiceImpl.ProcessQuery(Stream inputStream, IList1 pendingDisposableContainer) bei Microsoft.SharePoint.Client.ClientRequestService.ProcessQuery(Stream inputStream) bei SyncInvokeProcessQuery(Object , Object[] , Object[] ) bei System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) bei System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) bei System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) bei System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) bei System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) bei System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) bei System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) bei System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result) bei System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result) bei System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) bei System.Runtime.AsyncResult.Complete(Boolean completedSynchronously) bei System.Runtime.InputQueue1.AsyncQueueReader.Set(Item item) bei System.Runtime.InputQueue1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread) bei System.Runtime.InputQueue1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread) bei System.ServiceModel.Channels.SingletonChannelAcceptor3.Enqueue(QueueItemType item, Action dequeuedCallback, Boolean canDispatchOnThisThread) bei System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult result) bei System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult result) bei System.Runtime.AsyncResult.SyncContinue(IAsyncResult result) bei System.ServiceModel.Channels.HttpPipeline.EmptyHttpPipeline.BeginProcessInboundRequest(ReplyChannelAcceptor replyChannelAcceptor, Action dequeuedCallback, AsyncCallback callback, Object state) bei System.ServiceModel.Channels.HttpChannelListener1.HttpContextReceivedAsyncResult1.ProcessHttpContextAsync() bei System.ServiceModel.Channels.HttpChannelListener1.BeginHttpContextReceived(HttpRequestContext context, Action acceptorCallback, AsyncCallback callback, Object state) bei System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) bei System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() bei System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() bei System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) bei System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state) bei System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state) bei System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) bei System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) bei System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Leaving Monitored Scope: (EnsureListItemsData) Execution Time=5.8977; CPU Milliseconds=4; SQL Query Count=2; Parent=Microsoft.SharePoint.SPListItemCollection._SerializeToJson


1 Answer 1

1

"And" tag can not have more than 2 conditions. More conditions need to be nested like below. Please try this:

<View>
<Query>
    <Where>
        <And>
            <And>
                <Contains>
                    <FieldRef Name='Title'/>
                    <Value Type='Text'>te</Value>
                </Contains>
                <Neq>
                    <FieldRef Name='Lookupable'/>
                    <Value Type='Boolean'>0</Value>
                </Neq>
            </And>
            <Eq>
                <FieldRef Name='Testcriteria'/>
                <Value Type='Number'>1</Value>
            </Eq>
        </And>
    </Where>
</Query>

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.