Hello, I'm trying to use FullTextSqlQuery in to find a list of sharepoint sites a user has access to. Here's my code:
SPFarm farm = SPFarm.Local;
SPWebServiceCollection webServices =
new SPWebServiceCollection(farm);
foreach (SPWebService webService in webServices)
{
foreach (SPWebApplication webApp in webService.WebApplications)
{
using (FullTextSqlQuery fullTextSqlQuery = new
FullTextSqlQuery(ServerContext.GetContext(webApp)))
{
// Do some Initializtion
fullTextSqlQuery.QueryText =
"select title, path from scope() where (contentclass = 'STS_Web' or contentclass = 'STS_Site') order by path";
// execute the query and gather results
}
}
}
I naturally thought the search scope of an FullTextSqlQuery is defined by the argument of the constructor, as a web application would be the search scope in this case:
FullTextSqlQuery fullTextSqlQuery = new
FullTextSqlQuery(ServerContext.GetContext(webApp))
However, for each web application, the query returns exactly the same result, which means webApp is not used as a scope. So where how I define a scope for a query?
Thanks.