Wednesday, March 23, 2011

SharePoint Foundation Master Page Picker

By Stu


I recently began a new SharePoint 2010 branding project that requires only SharePoint 2010 Foundation be used. If you have worked in a purely Foundation environment you have probably quickly realized that there are no tools in Site Settings to allow you to select an alternate Master Page. So how do you create a custom branded Foundation Site if you cannot even select your new Master Page for testing or deployment? I found a great solution in the “Foundation Master Page Picker” on CodePlex and here is how to set it up!
SharePoint branding requires a lot of trial and error development. You can always start by developing your front-end code as pure HTML and CSS but eventually you have to deploy the code to a master page and get it working in SharePoint. Once you have done this, it’s matter of testing and tweaking until you get it just right. SharePoint injects a number of CSS classes that can mess with even the cleanest markup and it’s never as easy as simply injecting your pristine code and calling it done.
But what about SharePoint 2010 Foundation sites? The intent with Foundation was to use the theme system to change the look and feel. This is very apparent when you look at the site settings. There are no options for selecting a new master page and rather than modifying the v4.master, wouldn’t it be better to leave that in place as a backup? Building a new master page with a name that fits your project is always preferable to modifying the existing or default master pages.
In my research I found a great solution on CodePlex called the SharePoint Foundation Master Page Picker. However, if you are not familiar with SharePoint administration installing and deploying a solution can be intimidating and there is at least one gotcha I found with this solution that you should know about.
Download the solution
To start with you need to go get the solution. Download it from CodePlex and save to a folder on your SharePoint server.
Install the solution
The next thing you need to do is install it. To do this you are going to use stsadm.exe. This is a command line application used to numerous administration tasks on your server.
1. Open a command prompt – you can select it from your program menu or select Start and type cmd in the “search programs and files” box
2. Navigate to stsadm – stsadm is located in the hive. In command prompt you navigate by typing “cd” followed by a space and folder you want to open. On my server the path to stsadm is: c:program filescommon filesmicrosoft sharedweb server extensions14bin

3. Install the solution – now that we are in the bin we can execute commands against stsadm. To install this solution you need to run the following command:
stsadm -o addsolution -filename c:{your folder name here}IBS.SharePointFoundation.Utilities.wsp
You should get a confirmation that the solution was successfully installed, if not, check your command for extra spaces or other simple errors and try it again.

4. Deploying the solution – The next step is to deploy the solution. There are things that need to go into the GAC and running the “deploysolution” command will do this for us. There is a very specific way in which you need to deploy this solution and I only discovered through trial and error. Use the following command to deploy the solution:
stsadm -o deploysolution -name IBS.SharePointFoundation.Utilities.wsp -local -allowGacDeployment

5. Activate the Feature – Installation and deployment are now complete, all we have to do now is turn the functionality on. This is a site collection feature so navigation to the site settings page of the top level site in your site collection. Under Site Collection administration you will find a link to Site Collection Features, click on this link and activate the Master Page Picker feature.

6. Select a new master page – You’re done! To select a new master page for your Foundation site, go to Site Settings>Look and Feel and select the Master Page Picker. You will see a list of available master pages allowing you to select the one you want and click OK to change the master page.

Once you have created your custom master page and dropped it into the master page gallery it too will appear on this list as an available option.


Information from Stu

1 comment:

  1. It's interesting that many of the bloggers to  helped  clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
    Sharepoint Training in Chennai

    ReplyDelete