sharepointcamlbcs

Query large external list with CAML


I have a SharePoint external list that points to a 100,000 record SQL table. I have to set a filter on the Read List Operation otherwise the list doesnt work. It will timeout as it tries to return the full list. So I have added a Limit filter of size 200 onto the operation.

THe problem this causes is that when I query the external list using CAML it only searches the 200 entries returned, not the full list.

I would like it to search the entire list, but return only a maximum of 200 matching entries.

How can I best achieve this?


Solution

  • Maybe this answer att SharePoint-Exchange can help you. https://sharepoint.stackexchange.com/questions/31566/caml-and-external-list-pass-parameter-to-readlist-finder-method

    My idead is that you will probably need to modify your readlist-method to make sure that it reads the entire SQL-table but with the Where-parameter specified by the filter parameter in the readlist-method. Something like

    Pseudo code:

    public static IEnumerable<YourEntity> ReadList(string param)
    {
        if(string.IsNullOrEmpty(param) == true)
        {
            //Your original code thata only fetches the first 200 items
        }
        else
        {
            //Read your SQL-table with a Where ParamName = 'param' - clause
        }
    }
    

    Good luck