Here is the code snippet for the same.
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = properties.Feature.Parent as SPSite)
{
using (SPWeb web = site.OpenWeb())
{
//Logging feature activation status in list
web.AllowUnsafeUpdates = true;
//Changing the master page
web.CustomMasterUrl = "/commerce/Custom/_catalogs/masterpage/Custom.master";
web.MasterUrl = "/commerce/Custom/_catalogs/masterpage/Custom.master";
//Setting the Navigation propertiers for web
web.AllProperties["__IncludeSubSitesInNavigation"] = "False";
web.AllProperties["__IncludePagesInNavigation"] = "True";
web.Update();
}
}
}
web.AllProperties methods will change the navigation source for the web application, This you can change according to business need.
Thank you !!
No comments:
Post a Comment