The new metadata features in 2010 are of great value to us. With each of our assets having a unique accounting identifier and our document contributors having room for improvement with naming documents favorably for search it could be a life savor!
Add following reference to the solution
using
System.Globalization;
using
Microsoft.SharePoint;
using
Microsoft.SharePoint.Taxonomy;
To add term in the term store, add following code
SPSite site = new SPSite("http://newdemo2010"); TaxonomySession taxSession = new TaxonomySession(site); TermStore termStore = taxSession.TermStores["Managed Metadata Service"]; Group storeGroup = termStore.Groups["BPTemplate"]; TermSet termSet = storeGroup.TermSets["Timecard"]; termSet.CreateTerm(pTerm, 1033); //It will term to the root term
Term propertyIdsTerm = termSet.Terms["TimeLog"]; propertyIdsTerm.CreateTerm(pTerm, CultureInfo.CurrentCulture.LCID); //This will add term to a term termStore.CommitAll();
|
|
what is pTerm in the code
ReplyDelete