Make a instance of SPSite ospsite and use the below for Programmatically Inherit Master Page master page to all web in site collection
using(SPWeb web in ospsite.AllWeb())
{
web.MasterUrl = web.Site.RootWeb.MasterUrl;
web.CustomMasterUrl = web.Site.RootWeb.CustomMasterUrl;
web.AlternateCssUrl = web.Site.RootWeb.AlternateCssUrl;
web.Update();
}
Wednesday, June 3, 2009
Subscribe to:
Post Comments (Atom)
This post is what i've been looking for.
ReplyDeleteDo this works in Wss 3.0 also and where we need to place this code..in a feature?
Please clarify.
Note that when using the AllWeb attribute, you should dispose of the webs after the update to prevent memory leaks.
ReplyDeleteWeb.Dispose();
Hey, MOSS seems to function not that well when I use Vista in my laptop, but in XP Pro (PC) it works just fine. Can anyone figure this out for me?
ReplyDelete