Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Create a Term Set and Terms in SharePoint 2010 Programatically
WhatsApp
Sagar Pardeshi
Oct 16
2014
1.6
k
0
0
Created a Term Set in Managed Metadata Service Application then I can create a custom term set and terms using TaxonomyWebTaggingControl object is a Web control that can be added to a page so that a user can pick one or more taxonomy Term object from a specific TermSet object or from an entire TermStore object."
//add new term set into manage data
using
(SPSite site =
new
SPSite(SPContext.Current.Site.Url))
{
TaxonomySession _TaxonomySession =
new
TaxonomySession(site);
//Get instance of the Term Store
TermStore _TermStore = _TaxonomySession.TermStores[0];
//Now create a new Term Group
Group _Group = _TermStore.CreateGroup(
"MyGroup"
);
//Create a new Term Set in the new Group
TermSet _TermSet = _Group.CreateTermSet(
"MyTermset"
);
//Add terms to the term set
Term _term1 = _TermSet.CreateTerm(
"A Term"
, 1033);
Term _term2 = _TermSet.CreateTerm(
"B Term"
, 1033);
Term _term3 = _TermSet.CreateTerm(
"C Term"
, 1033);
Term _term4 = _TermSet.CreateTerm(
"D Term"
, 1033);
//commit changes
TermStore.CommitAll();
}
term set and terms
Up Next
Create a Term Set and Terms in SharePoint 2010 Programatically