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:
Im able to add links, but not to delete them :/ Any ideas? Thx
Edit: Ah got the fix :)
I cannot write just
Answer:
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)
Answer:
Try this code:
SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
for(int i = nodes.Count - 1; i >= 0; i--)
{
nodes[i].Delete();
}
No comments:
Post a Comment