I would like to delete all the links in a quicklaunch in SP2010 with C#. I tought this will do it, but somehow they are not gonna deleted:
SPNavigationNodeCollection n = subSite.Navigation.QuickLaunch;
foreach (SPNavigationNode node in n)
{
node.Delete();
}
Im able to add links, but not to delete them :/ Any ideas? Thx
Edit: Ah got the fix 🙂
I cannot write just node.Delete() I need to write n.Delete(node)
Edit2: hm somehow I dont get deleted ALL the links. If I run the code 2-3 Times then all of them are deleted, weird
Try this code:
see this link also: http://www.mtelligent.com/journal/2007/10/7/customizing-the-quick-launch-menu-with-spnavigationnode-spna.html