The following code should generate an ASCII art tree of a sharepoint website. But Navigation.QuickLaunch is only returning entries where the navigation order has been customised.

Does anyone know how to get around this? I need to use the same data as the quick launch area as the order the subsites are displayed in is important in some areas.

Merely disabling the automatic sorting doesn't seem to be enough to force it.

    void RecurseNavigation(SPWeb web)
        depth += 1;
        foreach (SPNavigationNode node in web.Navigation.QuickLaunch)
            sb.Append(new String('-', depth));
            sb.AppendLine(node.Title + " (" + node.Url + ")");
        depth -= 1;

1 Answer 1


Yes that's the behaviour as described by Damian Worrad in this blog post. He also describes how to change the entire list to something custom.

For your particular requirement, have a read of Robin Meure's post (based on Gary LaPointe's) which describes checking the IncludeInGlobalNavigation and IncludeInCurrentNavigation properties. Presumably there's also one for quick launch?

Another option might be querying the PortalSiteMapProvider.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.