I am trying to retrieve all Customer Contracts
which Customer Master
has Procurement Relevant = True
I used CSOM to communicate with SharePoint 2010 to retrieve list items and used CAML query to filter and join lists .
List list = web.Lists.GetByTitle("Customer Contracts");
var itemColl = await Task.Run<ListItemCollection>(() =>
{
CamlQuery query =//CAMEL query showed below
ListItemCollection coll = list.GetItems(query);
clientContext.Load(coll);
// Execute the query to the server
clientContext.ExecuteQuery();
return coll;
});
It raised the following exception when query executed
Exception : ( Microsoft.SharePoint.Client.ServerException was unhandled by user code HResult=-2146233088 Message=Value does not fall within the expected range. Source=Microsoft.SharePoint.Client.Runtime ServerErrorCode=-2147024809 ServerErrorTypeName=System.ArgumentException )
Check the following CAML query :
<View Scope="RecursiveAll">
<Query>
<Where>
<Eq>
<FieldRef Name="CustomerProcurementRelevant" />
<Value Type="String">True</Value>
</Eq>
</Where>
</Query>
<Joins>
<Join Type="INNER" ListAlias="Customer Master">
<Eq><FieldRef Name="Customer_x0020_ID" RefType="Id" />
<FieldRef List="Customer Master" Name="ID" />
</Eq>
</Join>
</Joins>
<ProjectedFields>
<Field Name="CustomerProcurmentRelevant" Type="Lookup" List="Customer Master" ShowField="Procurement_x0020_Relevant" />
</ProjectedFields>
<ViewFields>
<FieldRef Name="Modified" /><FieldRef Name="Customer_x0020_ID" /><FieldRef Name="Title" /><FieldRef Name="ES_x0020_Service_x0020_Segment" />
<FieldRef Name="ADE_x002f_ADM" /><FieldRef Name="Account_x0020_Controlling" /><FieldRef Name="Contract_x0020_terminated" /><FieldRef Name="Country" />
<FieldRef Name="CustomerProcurmentRelevant" />
</ViewFields>
<RowLimit>999999</RowLimit>
</View>