I'm creating a custom team site from a site definition and I can't seem to set the site to display the same navigation items as the parent site for the Global Navigation. I've tried using this code:
web.Navigation.UseShared = true; web.Update();
as well as trying with the PublishingWeb object:
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web); pubWeb.Navigation.InheritGlobal = true; pubWeb.Update();
I've also tried setting it via my onet.xml file by setting it here:
<!-- NavigationProperties Feature--> <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA"> <Properties xmlns="http://schemas.microsoft.com/sharepoint/"> <Property Key="InheritGlobalNavigation" Value="true"/>
I'm finding the only way I can set it is via powershell:
new-SPWeb "http://dev.site.com/subsite" -template "MySiteDefinitions#0" -useparenttopnav -name "Subsite"
but I can't use this at runtime. Has anyone had luck with this?