0

I am having a hard time understanding how a caml query fetches data from a SPO list. Currently, i have set up a client context on an CSOM console application and i am trying to upload a csv file onto a SPOList. The requirements of the project is that i check wether the entry has already passed, in which case i simply delete and insert the new entry, based on a FilenetID hex code. I get the error "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator." right at the moment that a CamlQuery is initialised, loaded on the client context and executed. Setting up a Logging action showed me that the error above started displayig once the limit 5k list items was reached and at the moment i cannot insert any more new entries. My CamlQuery is the below:

CamlQuery query = new CamlQuery
            {
                ViewXml = String.Format("@<View><Query><Where><Eq><FieldRef Name=\"FilenetID\" />" +
            "<Value Type=\"Text\">{0}</Value></Eq></Where></Query><RowLimit>10</RowLimit></View>", filenetID)
            };
var existingMappings = SpList.GetItems(query);
ClientContext.Load(existingMappings);
ClientContext.ExecuteQuery();
return existingMappings.FirstOrDefault();

The entries based on the FilenetID are unique, meaning that the CamlQuery above must return only one row. I even tried to set the RowLimit attribute but still i get the same error. My next step will be to index the column in question, but i would like to ask a question so that the community could please clarify upon the subject so that i could grasp a better understanding. Have you guys faced any of the above problems?

1 Answer 1

0

This is by design. Even the expected result only has one row, SP has to enumerate all items and check each of them meets the query condition. This will trigger "list view threshold".

To overcome it, you may have to index the filter column. Check below materials to get more details:

BR

1
  • Thanks for the links. Indexing the column that i am encopassing in the where clause seems to have fixed the problem. Although, as it is written here -> codeproject.com/Articles/1076854/… It is implied that with the correct search parameters it should work.
    – jimas13
    Nov 25, 2020 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.