Scopes are usually used in search code. One of the very common errors when working with scopes in search code is as following:
"Calling GetScopeID from a non-Office server binary."
This error occurs when you instantiate the query object, for example:
KeywordQuery kwQuery = new KeywordQuery(site);
To resolve this issue, include the correct namespace when defining the kwQuery object, for example:
Microsoft.Office.Server.Search.Query.KeywordQuery kwQuery = new Microsoft.Office.Server.Search.Query.KeywordQuery(site)
When you skip the namespace, SharePoint tries to call the GetScopeID() from an assembly different than the one it should be using. This especially happens when both of the following namespaces are included in your code:
using Microsoft.SharePoint.Search.Query;
using Microsoft.Office.Server;
using Microsoft.Office.Server;
No comments:
Post a Comment