Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When I output the terms in a term store, the first level terms are sorted alphabetically but the second level sub terms are not sorted. According to http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.term.terms.aspx the TermCollection returned by Term.Terms should be alpha sorted. I have verified that the Custom Sort is not set (ie. use default sort order). For example, my output is:

Codes and Standards
Database Management
--SQL Server
--Windows 7
--Business Rules
--Content Management
--Customer Support
--Developer Tips
--Internal Documentation
--Third Party Tools
--Visual Studio

What's wrong with this? Here's the code:

$session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession("http://server1")
$termstore = $session.TermStores[0]
$termSet = $termStore.GetTermSet("5d73591d-b25e-4b06-838d-df8b42aac762")
foreach ($term in $termSet.Terms)
    #Only output alpha sorted terms
    if ($term.CustomSortOrder -eq $NULL)
        foreach ($subterm in $term.Terms)
            "--" + $subterm.Name
share|improve this question

closed as too localized by Anders Rask Jun 2 '11 at 17:09

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

Browse other questions tagged or ask your own question.