Hi there am trying add links to left nav . I have this code but i cant get it to work as i get Object reference not set to an instance of an object.
Thanks kindly.
using (SPSite site = new SPSite("http://site")){
using (SPWeb web = site.RootWeb)
{
web.AllowUnsafeUpdates = true;
Microsoft.SharePoint.Navigation.SPNavigation sp = web.Navigation;
SPNavigationNode spn1 = new SPNavigationNode("some-title", "", true);
sp.QuickLaunch.AddAsFirst(spn1); //add to level1
web.Update();
}
}