Change the Subsites and Pages navigation setting by codeFebruary 27, 2008 11:12It took me quite some time to figure out how to change the Subsites and Pages settings by code. I finally manged to change them. The setting “Show subsites” can be altered in 2 ways. I was only able to change the “Show pages” on a publishing site.
Method 1 (”Show subsites” only)
SPWeb web = new SPSite(webCollection).OpenWeb();
web.AllProperties["__IncludeSubSitesInNavigation"] = “False”; web.Update(); web.Close(); web.Dispose(); Method 2
SPWeb web = new SPSite(webCollection).OpenWeb();
Tags: code, IncludePagesInNavigation, IncludeSubSitesInNavigation, pages, publishing, site, subsites, __IncludeSubSitesInNavigation.
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web); publishingWeb.IncludePagesInNavigation = false; publishingWeb.IncludeSubSitesInNavigation = false; publishingWeb.Update(); publishingWeb.Close(); web.Close(); web.Dispose(); Microsoft.SharePoint.Upgrade.SPUpgradeException: Action 12.0.1.0 of Microsoft.Office.Server. Search.Upgrade.SearchServiceInstanceSequence failedFebruary 1, 2008 14:14Migrating your SharePoint environment inside a virtual machine might cause some unexpected behaviour. It can be possible that you bump into this error: Tags: Configuration Wizard, exception, registry, SearchServiceInstanceSequence, Sharepoint, unexpected behaviour. |
||