Reputation: 1089
This works for existing site collection and any new sites under it and their subsites BUT when I create a new site collection, well i can't even create a new site collection now as it gives me file not found error as the root site of my new sitecollection is unable to find the masterpage...WHY?? I mean how??
using (SPWeb currentWeb = (SPWeb)properties.Feature.Parent)
{
using (SPSite currentSite = currentWeb.Site)
{
//Set Masterpage
Uri masterURI = new Uri(currentSite.Url + "/_catalogs/masterpage/V4Copy.master");
currentWeb.CustomMasterUrl = masterURI.AbsolutePath;
currentWeb.MasterUrl = masterURI.AbsolutePath;
currentWeb.Update();
}
}
Upvotes: 1
Views: 1124