Abe Miessler
Abe Miessler

Reputation: 85056

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

I thought I could just do something like this:

        SPQuery oQuery = new SPQuery();
        oQuery.ViewAttributes = "Scope='MyScope'";
        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?

Upvotes: 0

Views: 784

Answers (1)

Vladi Gubler
Vladi Gubler

Reputation: 2458

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.

Upvotes: 1

Related Questions