Domanda

In managed metadata service term store, I am iterating through all the groups, all termSets and all terms up to last level. I can iterate through group, termSet and root term (test1.1 in example below). In my case I have 4 or even more levels of terms, how i get to know if it is last term in terms hierarchy. which property or method will give this information? For example in below terms hierarchy how I get to know the last term programmatically? For example test1.1.1

enter image description here

È stato utile?

Soluzione

You can make use of properties Terms or TermsCount. This property provides the list of immediate Terms. So in your case you can use following logic

if(term.Terms == null || term.Terms.Count == 0)
    //means this term has no childern

if(term.TermsCount == 0)
    //means this term has no childern
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top