using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Taxonomy;
using System.Collections.ObjectModel;
namespace ManagedMetadataClient
{
class Program
{
static void Main(string[] args)
{
// ClienContext - Get the context for the SharePoint Site
// SharePoint site URL - http://c4968397007/
ClientContext clientContext = new ClientContext("http://c4968397007/");
// Get the TaxonomySession
TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
// Get the term store by Name
TermStore termStore = taxonomySession.TermStores.GetByName("MMS");
// Get the term group by Name
TermGroup termGroup = termStore.Groups.GetByName("SP2013");
// Get the term set by Name
TermSet termSet = termGroup.TermSets.GetByName("BCS");
// Get the term by Name
Term term = termSet.Terms.GetByName("External Content Type");
// string variable - Label Name
string labelName="ECT";
// int variable- LCID
int lcid=1033;
// bool variable - isDefault
bool isDefault=false;
// Create a new term for the term
Label label = term.CreateLabel(labelName, lcid, isDefault);
// Execute the query to the server
clientContext.ExecuteQuery();
}
}
}