Export (0) Print
Expand All

SPNavigation.QuickLaunch Property

Gets an Microsoft.SharePoint.Navigation.SPNavigationNodeCollection object that contains the nodes in the Quick Launch area of the site.

Namespace:  Microsoft.SharePoint.Navigation
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

[ClientCallableAttribute]
public SPNavigationNodeCollection QuickLaunch { get; }

Property Value

Type: Microsoft.SharePoint.Navigation.SPNavigationNodeCollection
The navigation nodes in the Quick Launch area.

The navigation nodes returned by this property are represented as headings in the Quick Launch area of the user interface. To modify the links below a heading, first get the SPNavigation object that represents the heading, then access that object's Children property to enumerate the collection of navigation nodes below the heading.

You can hide the Quick Launch area by setting the SPWeb.QuickLaunchEnabled property to false.

The following example is a console application that prints information about each heading in the Quick Launch area and about any items under each heading.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://localhost"))
            {
                using (SPWeb web = site.OpenWeb("/"))
                {
                    foreach (SPNavigationNode heading in web.Navigation.QuickLaunch)
                    {
                        Console.WriteLine("\n{0} [{1}]", heading.Title, heading.Url);

                        foreach (SPNavigationNode child in heading.Children)
                            Console.WriteLine(" {0} [{1}]", child.Title, child.Url);
                    }
                }
            }
            Console.Write("\nPress ENTER to continue....");
            Console.ReadLine();
        }
    }
}
Show:
© 2015 Microsoft