Posts

Showing posts from December, 2010

Custom Search Scopes at Site Collection Level

static void GetAvailableScopes()         {             SearchContext searchContext;             using ( SPSite site = new SPSite ( "Your Site Collection URL" ))             {                 searchContext = SearchContext .GetContext(site);                 Scopes scopes = new Scopes (searchContext);                 foreach ( Scope scope in scopes.AllScopes)                 {                                        Console .WriteLine( "\t Scope Name: {0}" , scope.Name);                     }             }         }   static void CreateScope()         {             SearchContext searchContext;             using ( SPSite site = new SPSite ( "Your Site Collection URL" ))             {                 searchContext = SearchContext .GetContext(site);                 Scopes scopes = new Scopes (searchContext);                 Scope newScope = scopes.AllScopes.Create( "Your Custom Scope" , "Scope Desc" , new Uri (site.U