SharePoint Create Term sets programatically.


Following piece of code creates a group named "Regions" and adds a Term Set with name "Asia" and India, Afghanistan and Pakistan as terms inside Asia Term set.
using (SPSite site = new SPSite("http://intranet.contoso.com"))
{
    TaxonomySession session = new TaxonomySession(site);
    TermStore store = session.TermStores[0];
    Group group = store.CreateGroup("Regions");
    TermSet ts = group.CreateTermSet("Asia");
    ts.CreateTerm("India",1033);
    ts.CreateTerm("Afghanistan",1033);
    ts.CreateTerm("Pakistan",1033);
    store.CommitAll();
}
profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+