Thursday, April 14, 2011

Changing the master page

I needed to change a master page today. It looks like if you want to do this through the web UI you first need to enable SharePoint Server Publishing Infrastructure site collection feature and the SharePoint Server Publishing site feature. Then there will be a link to Master Page Settings under Site Settings->Look and Feel. On top of that I found lots of complaints about the Top Link Bar disappearing after deactivating the publishing features. Sounds like a pain in the ass.

Well, instead of doing that through the Web UI, here's how you would do that through Powershell:
$web = Get-SPWeb "<site url>"
$web.MasterUrl = "<relative url to your master page>"
$web.Update()

Done! That's it. No screwing around with temporarily enabling features. Now, why doesn't the UI make it as easy? Who knows.

No comments:

Post a Comment