In case you ever need to load lots of Best Bets or keywords into MOSS, one way of doing it would be through custom XML file and simple console app below.
Here is the format of my XML file:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<BestBets>
<BestBet>
<Keyword>Teamsites</Keyword>
<Title>Teamsites</Title>
<Description>Team sites</Description>
<Url>http://Teamsites</Url>
</BestBet>
</BestBets>
And here is the code to handle the XML located in a 12 Hive\Resources\MyProject\:
const string BestBetsDefinitionFileRelativeUrl = “Resources\\MyProject\\BestBets.xml”;
const string BestBetTitle = “Title”;
const string BestBetDescription = “Description”;
const string BestBetUrl = “Url”;
const string BestBetKeyword = “Keyword”;static void Main(string [] args)
{
SPSite site = new SPSite(http://localhost);
SPWeb rootweb = site.OpenWeb();
Keywords keywords = new Keywords(SearchContext.GetContext(site), new Uri(rootweb.Url));
BestBetCollection bestbets = keywords.GetAllBestBets();
string bestBetsDefinitionFile = SPUtility.GetGenericSetupPath(BestBetsDefinitionFileRelativeUrl);StreamReader xmlFile = File.OpenText(bestBetsDefinitionFile);
XmlDocument BestBetsDefinition = new XmlDocument();
if (xmlFile != null)
{
BestBetsDefinition.LoadXml(xmlFile.ReadToEnd());
}foreach (XmlNode bestBet in
BestBetsDefinition.FirstChild.NextSibling.ChildNodes)
{keywords.AllKeywords.Create(bestBet[BestBetKeyword].InnerText, DateTime.Now);
keywords.AllKeywords[bestBet[BestBetKeyword].InnerText].BestBets.Create(
bestBet[BestBetTitle].InnerText,
bestBet[BestBetDescription].InnerText,
new Uri (bestBet[BestBetUrl].InnerText));
}rootweb.Dispose();
site.Dispose();
}
Happy best betting!