Saturday, April 20, 2013

Adding term in TermSet SharePoint

This code will be useful for understanding on how to add the "Term" into TermSet through programmatically. First create your new Metadata service and associate them in to site collection. This picture will explain the hierarchy of the taxonomy in SharePoint 2010 and SharePoint 2013.
I am trying to add the new term to termset called "Food"

                TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
                TermStore store = session.TermStores[0];
                Group group = store.Groups[0];
                TermSet set = group.TermSets[1];
                set.CreateTerm("Vada Payasam", 1033);
                store.CommitAll();