SharePoint Magic Item Limit “2000” when using Item Level Security


A couple of weeks ago we had production problems on retrieving information programmatically from a custom list in SharePoint. The list had reached 2000 items and every item in it had a different security pattern.

Our code to retrieve the items (the query is based on a Lookup-Field “Student”):

student = “5;#Derveaux Steven”
studentId = “5”
studentname = “Derveaux Steven”

string camlQuery =
 “<Where>” +
  “<Eq>” +
                        “<FieldRef Name=\”Student\” LookupId=\”True\” />” +
                        “<Value Type=\”User\”>” + studentId + “</Value>” +
                “</Eq>” +
 “</Where>”;

The expected result was only a couple of lines, nothing more but we didn’t get anything back, no exception was thrown or whatever…
If I deleted a random item (ItemCount was then 1999) there was no problem, starting from 2000 items … no data :-s

When we changed the caml query so that we don’t using “LookupId=True” and just the text we’ve received our items even above the 2000 items…

string camlQuery =
 “<Where>” +
  “<Eq>” +
                        “<FieldRef Name=\”Student\”  />” +
                        “<Value Type=\”User\”>” + studentname + “” +
                “</Eq>” +
 “</Where>”;

Strange, you want to search some items via their primary key (in lookup-fields) but you’re not getting any values back, if you’re using the text value (which is not necesserly unique!) of the lookup-field you don’t have any problem. In our case, the text value is unique but you may not asume it!

Advertisements
This entry was posted in Geen categorie. Bookmark the permalink.

2 Responses to SharePoint Magic Item Limit “2000” when using Item Level Security

  1. Joris says:

    Which version of SharePoint – 2010 or 2007?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s