I'm trying to work with large list but every time I do an operation on a list I have an exception because I have more than 5000 items in my list.
Microsoft.SharePoint.SPQueryThrottledException
If I do this code I have the exception.
sPList1.Folders.Count
How can I work with large list without enabled throttling?
EDIT: I don't understand how to use the query to check if there are folders:
query.QueryThrottleMode = SPQueryThrottleOption.Override;
My exception is thrown when i do:
if (sPList1.Folders.Count <= 0)
Here is the exception when I attempt to perform an action:
SPQuery query = new SPQuery();
query.QueryThrottleMode = SPQueryThrottleOption.Override;//execute query in admin and bypass throttling
query.Query = "<Where><Eq><FieldRef Name='FSObjType' /><Value Type='Integer'>1</Value></Eq></Where>";//caml to count folder
SPListItemCollection listitem = null;
listitem = sPList1.GetItems(query);