Skip to main content
deleted 266 characters in body
Source Link
Ali Jafer
  • 17.8k
  • 1
  • 28
  • 41

this should do the trick.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
     SPWeb Web = properties.Feature.Parent as SPWeb;

     Web.MasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.CustomMasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.Update();
 
     foreach (SPWeb subweb in Web.GetSubwebsForCurrentUser())
     {

        subweb.MasterUrl = Web.MasterUrl;
        subweb.CustomMasterUrl = Web.CustomMasterUrl;
        subweb.Update();
        subweb.Dispose();
     }

     Web.Dispose();
}

this should do the trick.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
     SPWeb Web = properties.Feature.Parent as SPWeb;

     Web.MasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.CustomMasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.Update();
 
     foreach (SPWeb subweb in Web.GetSubwebsForCurrentUser())
     {

        subweb.MasterUrl = Web.MasterUrl;
        subweb.CustomMasterUrl = Web.CustomMasterUrl;
        subweb.Update();
        subweb.Dispose();
     }

     Web.Dispose();
}

this should do the trick.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
     SPWeb Web = properties.Feature.Parent as SPWeb;

     Web.MasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.CustomMasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.Update();
    
     Web.Dispose();
}
Source Link
Ali Jafer
  • 17.8k
  • 1
  • 28
  • 41

this should do the trick.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
     SPWeb Web = properties.Feature.Parent as SPWeb;

     Web.MasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.CustomMasterUrl = Web.Site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/CustomMaster.master";

     Web.Update();

     foreach (SPWeb subweb in Web.GetSubwebsForCurrentUser())
     {

        subweb.MasterUrl = Web.MasterUrl;
        subweb.CustomMasterUrl = Web.CustomMasterUrl;
        subweb.Update();
        subweb.Dispose();
     }

     Web.Dispose();
}