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
--Organizations
Database Management
--Oracle
--SQL Server
Development
--Windows 7
--Business Rules
--Content Management
--Customer Support
--Developer Tips
--Internal Documentation
--Mobile
--Performance
--Testing
--Third Party Tools
--Utilities
--Visual Studio
--Database

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)
    {
        $term.Name
        foreach ($subterm in $term.Terms)
        {
            "--" + $subterm.Name
         }
     }
}
share|improve this question
add comment

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.

Browse other questions tagged or ask your own question.