protected void TaxonomyGetTermName(string url, string strTermName)
{
string valueOut = "";
try
{
using (ClientContext clientContext = new ClientContext(url))
{
clientContext.Credentials = new NetworkCredential("id", "pwd", "domain");
//
// Load up the taxonomy item names.
//
TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
TermStore termStore = taxonomySession.GetDefaultSiteCollectionTermStore();
clientContext.Load(termStore,
store => store.Name,
store => store.Groups.Include(
group => group.Name,
group => group.TermSets.Include(
termSet => termSet.Name,
termSet => termSet.Terms
).Where(termSet => termSet.Name == strTermName) //.Where(termSet => termSet.Name == "termname")
).Where(group => group.Name == "groupname")
);
clientContext.ExecuteQuery();
if (taxonomySession != null)
{
if (termStore != null)
{
foreach (TermGroup group in termStore.Groups)
{
Console.WriteLine("Group " + group.Name);
foreach (TermSet termSet in group.TermSets)
{
Console.WriteLine("TermSet " + termSet.Name);
foreach (Term NameLable in termSet.Terms)
{
NameLable.CustomProperties.TryGetValue("idofID", out valueOut );
DictionaryName.Add(NameLable.Name.ToLower(), valueOut );
}
}
}
}
}
}
}
catch (Exception ex)
{
}
}This code snippet is for Get Taxonomy value from Sharepoint 2013.