0

I have a large number of subsites that are similar. I want to make a global change to the sidebar navigation menu on all of these subsites. By change i want to add a new link. I have looked and i cannot seem to find anycode to help me do this.

Im using Sharepoint 2013 with CSOM and C#, but help with any programming language would be great to get me in the right direction.

2

Do you mean the quick launch. You may wanna try this code -

private static void AddNode(string url)

    {
        ClientContext context = new ClientContext(url);

        context.Load(context.Web);

        //Fetching website's Left Navigation node collection

        NavigationNodeCollection qlNavNodeColl = context.Web.Navigation.QuickLaunch;

        //Create a new node

    NavigationNodeCreationInformation newNavNode = new NavigationNodeCreationInformation();

    newNavNode.Title = "Google";

    newNavNode.Url = "https://www.google.com"; //URL must always start with http/https

    qlNavNodeColl.Add(newNavNode);

    try
    {
        context.ExecuteQuery();
    }
    catch (Exception)
    {
        //Handle exception
    }
}

Source : Add/Update/Delete nodes from QuickLaunch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.