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)

'Declaration
Public ReadOnly Property QuickLaunch As SPNavigationNodeCollection
	Get
'Usage
Dim instance As SPNavigation
Dim value As SPNavigationNodeCollection

value = instance.QuickLaunch

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.

Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Navigation

Module ConsoleApp

    Sub Main()

        Using site As New SPSite("http://localhost")

            Using web As SPWeb = site.OpenWeb("/")

                For Each heading As SPNavigationNode In web.Navigation.QuickLaunch
                    Console.WriteLine(vbLf & "{0} [{1}]", heading.Title, heading.Url)

                    For Each child As SPNavigationNode In heading.Children
                        Console.WriteLine(" {0} [{1}]", child.Title, child.Url)
                    Next
                Next

            End Using

        End Using

        Console.Write(vbCrLf & "Press ENTER to continue....")
        Console.Read()
    End Sub

End Module
Show:
© 2014 Microsoft