开发者

How to get all items in a search scope in SharePoint 2010?

开发者 https://www.devze.com 2023-02-01 22:40 出处:网络
I thought I could just do something like this: SPQuery oQuery = new SPQuery(); oQuery.ViewAttributes = \"Scope=\'MyScope\'\";

I thought I could just do something like this:

        SPQuery oQuery = new SPQuery();
        oQuery.ViewAttributes = "Scope='MyScope'";
开发者_JAVA技巧        SPListItemCollection collListItems = oList.GetItems(oQuery);

but it is pulling back a bunch of stuff that is not in the scope. Is there a different way I should be doing this?


You are confusing SPQuery, which a list querying class, based on CAML, and the search API. Take a look into FullTextSqlQuery, which is the class you really should work with.

0

精彩评论

暂无评论...
验证码 换一张
取 消