Search Results for

    Show / Hide Table of Contents

    Class NavigationExtensions

    This class holds navigation related methods

    Inheritance
    System.Object
    NavigationExtensions
    Namespace: Microsoft.SharePoint.Client
    Assembly: PnP.Framework.dll
    Syntax
    public static class NavigationExtensions : object

    Methods

    AddCustomAction(Site, CustomActionEntity)

    Adds custom action to a site collection. If the CustomAction exists the item will be updated. Setting CustomActionEntity.Remove == true will delete the CustomAction.

    Declaration
    public static bool AddCustomAction(this Site site, CustomActionEntity customAction)
    Parameters
    Site site

    Site collection to be processed

    CustomActionEntity customAction

    Information about the custom action be added or deleted

    Returns
    System.Boolean

    True if action was successfull

    AddCustomAction(Web, CustomActionEntity)

    Adds custom action to a web. If the CustomAction exists the item will be updated. Setting CustomActionEntity.Remove == true will delete the CustomAction.

    Declaration
    public static bool AddCustomAction(this Web web, CustomActionEntity customAction)
    Parameters
    Web web

    Site to be processed - can be root web or sub site

    CustomActionEntity customAction

    Information about the custom action be added or deleted

    Returns
    System.Boolean

    True if action was successfull

    Examples

    var editAction = new CustomActionEntity() { Title = "Edit Site Classification", Description = "Manage business impact information for site collection or sub sites.", Sequence = 1000, Group = "SiteActions", Location = "Microsoft.SharePoint.StandardMenu", Url = EditFormUrl, ImageUrl = EditFormImageUrl, Rights = new BasePermissions(), }; editAction.Rights.Set(PermissionKind.ManageWeb); web.AddCustomAction(editAction);

    AddNavigationNode(Web, String, Uri, String, NavigationType, Boolean, Boolean, String)

    Add a node to quick launch, top navigation bar or search navigation. The node will be added as the last node in the collection.

    Declaration
    public static NavigationNode AddNavigationNode(this Web web, string nodeTitle, Uri nodeUri, string parentNodeTitle, NavigationType navigationType, bool isExternal = false, bool asLastNode = true, string l1ParentNodeTitle = null)
    Parameters
    Web web

    Site to be processed - can be root web or sub site

    System.String nodeTitle

    the title of node to add

    Uri nodeUri

    the URL of node to add

    System.String parentNodeTitle

    if string.Empty, then will add this node as top level node. Contains the title of the immediate parent node, for third level nodes, providing l1ParentNodeTitle is required.

    NavigationType navigationType

    the type of navigation, quick launch, top navigation or search navigation

    System.Boolean isExternal

    true if the link is an external link

    System.Boolean asLastNode

    true if the link should be added as the last node of the collection

    System.String l1ParentNodeTitle

    title of the first level parent, if this node is a third level navigation node

    Returns
    NavigationNode

    Newly added NavigationNode

    CustomActionExists(Site, String)

    Utility method to check particular custom action already exists on the web

    Declaration
    public static bool CustomActionExists(this Site site, string name)
    Parameters
    Site site

    Site to process

    System.String name

    Name of the custom action

    Returns
    System.Boolean

    CustomActionExists(Web, String)

    Utility method to check particular custom action already exists on the web

    Declaration
    public static bool CustomActionExists(this Web web, string name)
    Parameters
    Web web

    Web to process

    System.String name

    Name of the custom action

    Returns
    System.Boolean

    DeleteAllNavigationNodes(Web, NavigationType)

    Deletes all Navigation Nodes from a given navigation

    Declaration
    public static void DeleteAllNavigationNodes(this Web web, NavigationType navigationType)
    Parameters
    Web web

    Site to be processed - can be root web or sub site

    NavigationType navigationType

    The type of navigation to support

    DeleteCustomAction(Site, Guid)

    Removes a custom action

    Declaration
    public static void DeleteCustomAction(this Site site, Guid id)
    Parameters
    Site site

    The site to process

    Guid id

    The id of the action to remove. GetCustomActions

    DeleteCustomAction(Web, Guid)

    Removes a custom action

    Declaration
    public static void DeleteCustomAction(this Web web, Guid id)
    Parameters
    Web web

    The web to process

    Guid id

    The id of the action to remove. GetCustomActions

    DeleteNavigationNode(Web, String, String, NavigationType)

    Deletes a navigation node from the quickLaunch or top navigation bar

    Declaration
    public static void DeleteNavigationNode(this Web web, string nodeTitle, string parentNodeTitle, NavigationType navigationType)
    Parameters
    Web web

    Site to be processed - can be root web or sub site

    System.String nodeTitle

    the title of node to delete

    System.String parentNodeTitle

    if string.Empty, then will delete this node as top level node

    NavigationType navigationType

    the type of navigation, quick launch, top navigation or search navigation

    GetCustomActions(Site, Expression<Func<UserCustomAction, Object>>[])

    Returns all custom actions in a web

    Declaration
    public static IEnumerable<UserCustomAction> GetCustomActions(this Site site, params Expression<Func<UserCustomAction, object>>[] expressions)
    Parameters
    Site site

    The site to process

    Expression<Func<UserCustomAction, System.Object>>[] expressions

    List of lambda expressions of properties to load when retrieving the object

    Returns
    IEnumerable<UserCustomAction>

    Returns all custom actions

    GetCustomActions(Web, Expression<Func<UserCustomAction, Object>>[])

    Returns all custom actions in a web

    Declaration
    public static IEnumerable<UserCustomAction> GetCustomActions(this Web web, params Expression<Func<UserCustomAction, object>>[] expressions)
    Parameters
    Web web

    The web to process

    Expression<Func<UserCustomAction, System.Object>>[] expressions

    List of lambda expressions of properties to load when retrieving the object

    Returns
    IEnumerable<UserCustomAction>

    Returns all custom actions

    GetEditableNavigationTermSet(Web, ManagedNavigationKind)

    Returns an editable version of the Global Navigation TermSet for a web site

    Declaration
    public static NavigationTermSet GetEditableNavigationTermSet(this Web web, ManagedNavigationKind navigationKind)
    Parameters
    Web web

    The target web.

    ManagedNavigationKind navigationKind

    Declares whether to look for Current or Global Navigation

    Returns
    NavigationTermSet

    The editable Global Navigation TermSet

    GetFooterLogoUrl(Web)

    Returns the server relative URL of the logo shown in the footer

    Declaration
    public static string GetFooterLogoUrl(this Web web)
    Parameters
    Web web

    Web instance to return the footer logo url of

    Returns
    System.String

    Server relative URL of the logo shown in the footer or NULL if no footer has been set

    GetFooterTitle(Web)

    Returns the title shown in the footer

    Declaration
    public static string GetFooterTitle(this Web web)
    Parameters
    Web web

    Web instance to return the footer title of

    Returns
    System.String

    Title shown in the footer or NULL if no title has been set

    GetNavigationSettings(Web)

    Returns the navigation settings for the selected web

    Declaration
    public static AreaNavigationEntity GetNavigationSettings(this Web web)
    Parameters
    Web web

    Web to process

    Returns
    AreaNavigationEntity

    Returns AreaNavigationEntity settings

    IsManagedNavigationEnabled(Web, ManagedNavigationKind)

    Determines whether the current Web has the managed navigation enabled

    Declaration
    public static bool IsManagedNavigationEnabled(this Web web, ManagedNavigationKind navigationKind)
    Parameters
    Web web

    The target web.

    ManagedNavigationKind navigationKind

    The kind of navigation (Current or Global).

    Returns
    System.Boolean

    A boolean result of the test.

    LoadFooterNavigation(Web)

    Returns the navigation elements shown in the footer

    Declaration
    public static NavigationNodeCollection LoadFooterNavigation(this Web web)
    Parameters
    Web web

    Web instance to return the footer navigation of

    Returns
    NavigationNodeCollection

    NavigationNodeCollection containing the navigation elements shown in the footer or NULL if no navigation has been set on the footer

    LoadSearchNavigation(Web)

    Loads the search navigation nodes

    Declaration
    public static NavigationNodeCollection LoadSearchNavigation(this Web web)
    Parameters
    Web web

    Site to be processed - can be root web or sub site

    Returns
    NavigationNodeCollection

    Collection of NavigationNode instances

    RemoveFooterLogoUrl(Web)

    Removes the logo shown in the footer

    Declaration
    public static bool RemoveFooterLogoUrl(this Web web)
    Parameters
    Web web

    Web instance to remove the footer of

    Returns
    System.Boolean

    Boolean indicating if removing the logo succeeded

    SetFooterLogoUrl(Web, String)

    Sets the logo shown in the footer

    Declaration
    public static bool SetFooterLogoUrl(this Web web, string logoUrl)
    Parameters
    Web web

    Web instance to set the footer logo url of

    System.String logoUrl

    Server relative path to the logo to show in the footer

    Returns
    System.Boolean

    Boolean indicating if setting the logo succeeded

    SetFooterTitle(Web, String)

    Sets the title shown in the footer

    Declaration
    public static bool SetFooterTitle(this Web web, string title)
    Parameters
    Web web

    Web instance to set the footer title of

    System.String title

    Title to show in the footer

    Returns
    System.Boolean

    Boolean indicating if setting the title succeeded

    UpdateNavigationInheritance(Web, Boolean)

    Updates the navigation inheritance setting

    Declaration
    public static void UpdateNavigationInheritance(this Web web, bool inheritNavigation)
    Parameters
    Web web

    Site to be processed - can be root web or sub site

    System.Boolean inheritNavigation

    boolean indicating if navigation inheritance is needed or not

    UpdateNavigationSettings(Web, AreaNavigationEntity)

    Updates navigation settings for the current web

    Declaration
    public static void UpdateNavigationSettings(this Web web, AreaNavigationEntity navigationSettings)
    Parameters
    Web web

    Web to process

    AreaNavigationEntity navigationSettings

    Navigation settings to update

    Back to top PnP Framework
    Generated by DocFX with Material UI
    spacer