使用CAML查询大型外部列表

Mor*_*ort 7 sharepoint caml bcs

我有一个SharePoint外部列表,指向100,000个记录SQL表.我必须在读取列表操作上设置过滤器,否则列表不起作用.它会在尝试返回完整列表时超时.所以我在操作中添加了一个大小为200的限制过滤器.

这个问题导致的是,当我使用CAML查询外部列表时,它只搜索返回的200个条目,而不是完整列表.

我希望它能够搜索整个列表,但最多只返回200个匹配条目.

我怎样才能做到最好?

小智 2

也许 SharePoint-Exchange 的这个答案可以帮助您。 https://sharepoint.stackexchange.com/questions/31566/caml-and-external-list-pass-parameter-to-readlist-finder-method

我的想法是,您可能需要修改您的 readlist-method 以确保它读取整个 SQL 表,但使用 readlist-method 中的过滤器参数指定的Where-参数。就像是

伪代码:

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
    }
}
Run Code Online (Sandbox Code Playgroud)

祝你好运