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

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 + ")");
            RecurseNavigation(root.OpenWeb(node.Url));
        }
        depth -= 1;
    }
share|improve this question

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.