using (SPSite site = new SPSite("http://SPSitecoll"))
{
using (SPWeb web = site.OpenWeb("SubSite"))
{
if (web.IsRootWeb)
{
// Get the top link bar.
SPNavigationNodeCollection topnav = web.ParentWeb.Navigation.TopNavigationBar;
string linkTitle = web.Title; -> Adding Web's title as Link
// Create the node.
SPNavigationNode node = new SPNavigationNode(linkTitle, web.ServerRelativeUrl);
node = topnav.AddAsLast(node);
}
}
}
Ads by Google
No comments:
Post a Comment