Skip to main content
added 1315 characters in body
Source Link

Here is a post about adding itemsmethod to add an item to the quick launch with code.in C#

http://chrisbarba.com/2013/07/18/how-to-add-an-item-to-the-quick-launch-in-sharepoint/

private void AddNodeToQuickLaunch(string linkName, string SiteToOpen, string pathtoPage)
   {
       try
       {
           using (SPWeb web = SPContext.Current.Site.OpenWeb(SiteToOpen))
           {
               web.AllowUnsafeUpdates = true;

               SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;

               SPNavigationNode createNode = new SPNavigationNode(linkName, pathtoPage, true);

               foreach (SPNavigationNode node in nodes)
               {
                   bool nodeExists = false;
                   if (node.Title.Equals("Lists"))
                   {
                       foreach (SPNavigationNode child in node.Children)
                       {
                           if (child.Title == linkName)
                           {
                               nodeExists = true;
                           }
                       }

                       if (!nodeExists)
                       {
                           node.Children.Add(createNode, node);
                       }
                   }
               }
               web.AllowUnsafeUpdates = false;
           }
       }
       catch (Exception ex)
       {
           throw ex;
       }
   }

Here is a post about adding items to the quick launch with code.

http://chrisbarba.com/2013/07/18/how-to-add-an-item-to-the-quick-launch-in-sharepoint/

Here is a method to add an item to the quick launch in C#

private void AddNodeToQuickLaunch(string linkName, string SiteToOpen, string pathtoPage)
   {
       try
       {
           using (SPWeb web = SPContext.Current.Site.OpenWeb(SiteToOpen))
           {
               web.AllowUnsafeUpdates = true;

               SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;

               SPNavigationNode createNode = new SPNavigationNode(linkName, pathtoPage, true);

               foreach (SPNavigationNode node in nodes)
               {
                   bool nodeExists = false;
                   if (node.Title.Equals("Lists"))
                   {
                       foreach (SPNavigationNode child in node.Children)
                       {
                           if (child.Title == linkName)
                           {
                               nodeExists = true;
                           }
                       }

                       if (!nodeExists)
                       {
                           node.Children.Add(createNode, node);
                       }
                   }
               }
               web.AllowUnsafeUpdates = false;
           }
       }
       catch (Exception ex)
       {
           throw ex;
       }
   }
removed sig
Source Link
SPDoctor
  • 9.6k
  • 2
  • 35
  • 60

Here is a post about adding items to the quick launch with code.

http://chrisbarba.com/2013/07/18/how-to-add-an-item-to-the-quick-launch-in-sharepoint/

Chris

http://chrisbarba.com

Here is a post about adding items to the quick launch with code.

http://chrisbarba.com/2013/07/18/how-to-add-an-item-to-the-quick-launch-in-sharepoint/

Chris

http://chrisbarba.com

Here is a post about adding items to the quick launch with code.

http://chrisbarba.com/2013/07/18/how-to-add-an-item-to-the-quick-launch-in-sharepoint/

Source Link

Here is a post about adding items to the quick launch with code.

http://chrisbarba.com/2013/07/18/how-to-add-an-item-to-the-quick-launch-in-sharepoint/

Chris

http://chrisbarba.com