Wednesday, 9 September 2009

Problem adding Keywords and Best Bets programmatically in MOSS 2007

I was writing a small Windows application for a customer to create keywords and best bets using a CSV file and experienced a weird problem. I used the code published here by Stefan Goßner as a starting point, which successfully added the keywords to the Manage Keywords UI in Site Collection Administration, but when I tried to search on one of the keywords, no best bets were shown in the search results.

The format of the CSV file was, as follows:

Keyword name, Synonyms (semi-colon delimited), Best bet URL

For example: Acme Primary School, Acme;Acme School;Acme Primary,

The code I used to create the keywords was:

keywords.AllKeywords.Create(keywordTerm, DateTime.Today.AddHours(-1));
keywords.AllKeywords[keywordTerm].BestBets.Create(objBestBet.ToString() + " Profile", "Full school profile for " + objBestBet.ToString(), new Uri(objUrl.ToString()));

I then found that if I clicked on one of these keywords in the Manage Keywords UI and clicked OK without changing anything, the search for that keyword worked. I eventually discovered that SharePoint didn’t like adding the semi-colon delimited synonyms as a single string and that they needed to be created separately. Therefore, I changed the code to below, using the semi-colons to split the string up into an array of separate synonyms, which worked:

keywords.AllKeywords.Create(keywordTerm, DateTime.Today.AddHours(-1));
//Create synonyms from semi-colon separated array
string[] synonymArray = objSynonyms.ToString().Split(new char[] { ';' });
foreach (string synonym in synonymArray)
keywords.AllKeywords[keywordTerm].BestBets.Create(objBestBet.ToString() + " Profile", "Full school profile for " + objBestBet.ToString(), new Uri(objUrl.ToString()));


  1. Hi Phil,

    I too face the same problem.
    I have added only Keyword, definition & best bet but still i am not getting keyword in search.
    then if i simply edit the keyword in UI & then clickin OK, now keyword is displayed in serach.

    Kindly let me know how to solve this issue bcoz u have mentioned that u have seperated Synonyms by semicolon";" but i havn't added

  2. Hi,

    Have you updated your keywords after the changes (see last line in my code above)? The problem I was having was with synonyms, so if you haven't got any then it is probably a different issue to the one I had.


  3. Can you post a "step-by-step" for doing this with a CSV for SharePoint / FAST 2010? I'm starting to loose all my hair on this ;) Any help would be greatly appreciated.


  4. Hi Bryan - I have posted a reply to this on my PowerShell blog at


  5. || || || n || || || || n ||

  6. If you have a history of illness that is difficult to recover, maybe our next article will help you to recover

    Obat Untuk kaligata
    Obat Untuk Menghilangkan keputihan
    Obat Pengering luka bernanah
    Obat luka
    Obat eksim

  7. Ce sac cartable Michael Kors est si universel qu'il pourrait plaire à tout le monde. Dans cet article, je vais essayer de passer en revue les caractéristiques principales et les éléments qui distinguent ce sac à main des autres.

    tags:Bolsos Michael Kors Rebajas,Bolsos Michael Kors Baratos,Bolsos Michael Kors El Corte Ingles

    L’extérieur de ce fourre-tout Michael Kors est un cuir métallisé de laiton froncé et froncé. Si vous connaissez les sacs à main Michael Kors, vous savez que ce cuir sera doux et souple. Les deux grandes poignées supérieures sont attachées au sac avec quelques centimètres de chaînes dorées, puis les moitiés supérieures des bretelles présentent le même cuir couleur laiton.

    tags:Bolsos Michael Kors Baratos,Michael Kors Örhängen

    La diversité des couleurs et la taille utilisable de ce sac le rendent parfait pour un usage quotidien. Les poches intérieures ne manquent pas pour aider à garder les choses en ordre. Il y a des endroits parfaits pour votre téléphone ou votre Blackberry. Le zip top empêche les malfaiteurs de saisir votre sac dans un bar et aide également à contenir tout ce qui se trouve à l'intérieur lorsque vous courez pour créer ce train.

    tags:Windguru Longchamps,Longchamp Soldes Destockage,Pronote College Longchamp

  8. Michael Kors Outlet Online was a huge success there and became very well known. The designer Kors then branched out into accessories including Michael Kors Handbags Clearance. He never lost focus on his American chic styling. Some of his most notable collections include the Michael Kors Totes, Michael Kors satchel and the Designer MK Outlet and Michael Kors Outlet Online Store.

    No one has to know that they are cheap Ray Ban Sale UK and no one will know unless you tell them. Each of the cheap designer Ray Ban Sunglasses Sale UK carries the signature brand on the lens to let you know that you do have authentic designer Cheap Ray Ban Sunglasses UK.

    tags: Cheap Oakley Sunglasses UK,MK Outlet

  9. Both things are possible if you carry Michael Kors Handbags Wholesale. If you are a woman who goes for innovative designs, a designer Michael Kors Bags On Sale is perfect for you. Offering a huge selection of chic purses, handbags, shoes and accessories, Michael Kors Outlet Online Store celebrates womanhood in an entirely unique way. Michael Kors Factory Outlet Online Store At Wholesale Price are one of the most sought-after handbags worldwide. We all agree that diamonds are a woman's best friend; however Official Coach Factory Outlet Online are absolutely next in line. To Coach Outlet Sale aficionados, don't fret because we have great news: a discount Official Coach Outlet Online isn't hard to find. If you are a smart shopper looking for a good buy and great deals on your next handbag purchase, you can go to Official Coach Outlet Online.

    Friendly Links: Toms Shoes Womens | Toms Clearance

  10. khasiat dari obat tersebut bisa memberikan manfaat pada pasutri yang ingin mendapatkan kepuasan dalam bercinta agar kedua pasangan semakin harmonis ketika bercinta. bagi anda yang ingin mendapatkan viagra asli bisa anda beli diberbagai tempat asal sudah terbukti dengan keaslian produk dengan cara mengenali viagra usa asli pfizer 100 mg langsung dari berbagai situs yang sudah terpercaya atau dari refrensi teman yang sudah menggunakan viagra asli usa pfizer 100 mg silahkan anda berkunjung kesitus resmi agen yang ada diindonesia dan yang secara resmi menjadi agen distributor viagra asli usa 100 mg sejak tahun 1995 sampai sekarang. klik disini . selanjutnya ada produk dari amerika lainnya yang sangat terkenal baru-baru ini yaitu vimax asli berkhasiat untuk ereksi dan untuk memperbesar alat vital pria secara permanen berguna untuk memaksimalkan kepuasan saat diranjang.

  11. Austin is more known for its scenic natural beauty and its music than for its architecture, but there are plenty of must see landmarks in this city. The Governor's Mansion, a Greek Revival masterpiece designed by noted architect Abner Cook, is a real showplace, with the Governor and family in private residences on the second floor. There are also the Moonlight Towers; of the 31 originally bought from the city of Detroit, 17 still survive today. (Michael Kors Greenwich Bucket Bag Black)

    Coach Bags Factory Outlet, 2019 Acura RDXThe Acura RDX is all new for the 2019 model year, and we like it a lot more than the somewhat boring 2018 edition. There's a new turbocharged four cylinder engine underhood that delivers 272 horsepower and 280 pound feet of torque. It's hooked up to a 10 speed automatic transmission that does a great job of maximizing performance and efficiency..

    White Coach Purse With Flowers, Falk throws 3 TDs, No. 19 Washington State beats Utah 33 25Washington State v UtahSALT LAKE CITY, UT NOVEMBER 11: Daniel Ekuale 90 of the Washington State Cougars gestures after a first half stop against the Utah Utes at Rice Eccles Stadium on November 11, 2017 in Salt Lake City, Utah. (Photo by Gene Sweeney Jr/Getty Images).

    It's not just planes it's every piece of equipment. It all needs constant upkeep and babysitting. In the Navy, out of the 250 to 300 ships in the fleet, only a hundred are up and working at any one time. (Michael Kors Crossbody Bag Jet Set Black)

    Coach Outlet Petal Bag, Consider the pebbles shown here. These are of medium size in relation to those on other parts of the beach. They are in dry condition and, as such, do not show the details well for identification.

    How To Clean White Leather Coach Bag, From 1st October 2018, company has taken a price increase to the tune of 2% in GVT. Revenue from Sanitaryware / faucet grew 31.5% YoY to INR 435mn. We are positive on the long term prospects of the company given its leadership position and execution capabilities, in addition to this, the favorable long term demand drivers such as declining interest rate cycle, normal monsoon and GST rate reduction are likely to spur demand.At CMP of INR 379, the stock is trading at 28.7XFY19E and 21.5XFY20E earnings.



  13. The latest trend in Coach Outlet Online is to purchase them secondhand.
    Today, buying Michael Kors Bags Outlet is looked upon as a smart choice.
    Because Michael Kors Purse Outlet are crafted of the finest material, they are known to last for many years, making them the perfect purchase.
    Some women are fanatical about changing their Coach Outlet Store Online or their style every few months, making it necessary to periodically clean out their wardrobe.
    Other women buy a MK Outlet for one specific occasion and some women just make a habit of buying a lot of purses.
    The trends are changing today; more and more people are buying classic shoes, including designer Cheap Real Yeezys.
    If your dream has always been to own a Cheap Yeezys, it is possible just by finding a store and click here.
    Coach Bags Clearance are pursued by many famous characters.
    Coach Bags Outlet in different styles and different colors are in different leathers.
    Next time, I will share some knowledge about how to maintain the bags in different material.