Thursday, 18 April 2013

SharePoint 2010 - List View Threshold


Any well utilised SharePoint farm will hit this limit at one point or another, the annoying but not hard to resolve LIST VIEW THRESHOLD ISSUE!!!!!!


If you're on the ball, you'll know to cater for this when first creating a list you know is going to be quite popular with the lads.  This involves creating indexed columns, and creating views that filter on the indexed columns.

But woe to those who wait for the dreadful message to appear, and also to those who prepared for it, but it is still occurring anyway.   WHHHHHHYYYYYYYYYYYYYYYYYYY!!!!!!!!!!!!....

STOP!  CAML TIME!

Well it's because when you modify a view using the SharePoint GUI, and you filter on a indexed column and maybe a few others, SharePoint turns your filters & options into a CAML query, and if that query contained a few different column filters, SharePoint occasionally doesn't render the CAML query in a manner that ensures you are always querying less than the List View Threshold!

OH NOES!

Oh yes.  If this happens, it means that you will have to manually create the CAML query on the page using SharePoint Designer.  Just make sure that the FIRST column you filter on is an indexed column that will bring back less items than the List View Threshold limit.

Never had to write CAML?  well there's plenty of info on Google for CAML queries, so I won't explain it here.  but I will supply an example below for interests sake.  Any questions let me know :)

EXAMPLE CAML:

<Query>
<Where>
<And>
<Eq>
<FieldRef Name="Status"/>
<Value Type="Text">Open</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="User">Simon Blob</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="User">Roger Reporter</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="User">Moses Roses</Value>
</Eq>
<Eq>
<FieldRef Name="AssignedTo"/>
<Value Type="User">Daniel Dogood</Value>
</Eq>
</Or>
</Or>
</Or>
</And>
</Where>
</Query>
END OF EXAMPLE CAML.

No comments:

Post a Comment