I need some support in how to target specific views within a SharePoint Online list using CAML.
Just last week our script started to fail because we've now hit the view thresholds of our list - it's now sitting at 7500 items.
We've gone through the columns and indexed what fields are being referenced but the error is still appearing. My thought is to now target a particular view instead of the default as we only need those items which are of a particular status retrieved.
I've tried to use the View element examples found here but no matter what I input I'm just getting the default back.
Here's the CAML query:
<View> <Query> <Where> <Or> <Eq> <FieldRef Name='Status' /> <Value Type='Choice'>Provisioning Site</Value> </Eq> <Eq> <FieldRef Name='Status' /> <Value Type='Choice'>Requested</Value> </Eq> </Or> </Where> <OrderBy><FieldRef Name='Status' Ascending='FALSE' /></OrderBy> </Query> </View>
And here's the error we're currently getting.
System.Management.Automation.MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator." ---> Microsoft.SharePoint.Client.ServerException: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator. at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at CallSite.Target(Closure , CallSite , ClientContext ) --- End of inner exception stack trace --- at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at GetAllListItems(Closure , FunctionContext ) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.CommandProcessorBase.Complete()