Below is the source code used in a web part.
string strDescription = string.Empty;
string strTermGuid = MetadataNavigationContext.Current.UniqueNodePath;
if (string.IsNullOrEmpty(strTermGuid))
return;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
TaxonomySession objTaxonomySession = new TaxonomySession(SPContext.Current.Site);
Guid guidTermID = new Guid(strTermGuid);
Term objTerm = objTaxonomySession.GetTerm(guidTermID);
strDescription = objTerm.GetDescription();
});
Label1.Text = strDescription;
This was exactly what i wasm looking for, however in MS documentation is says that MetadataNavigationContext.UniqueNodePath is reserved for internal use, any ideas on how to do this in a supported way?
ReplyDelete