How To: create Keywords and Best Bets for MOSS Search programmatically
Yesterday I received an interesting question: a customer had the need to import several hundred keywords and related best bets programmatically to a couple of site collections. And for sure he did not want to do this manually using the web UI. I found the following solution for this problem: SPSite spsite = new SPSite(“http://localhost:4007”); SearchContext searchContext = SearchContext.GetContext(spsite); Keywords keywords = new Keywords(searchContext, new Uri(“http://localhost:4007”)); // loop begin Keyword myKeyword = keywords.AllKeywords.Create(“myKeyword”, DateTime.Now); […]