Live from the SPC11 : Branding and Customizing My Sites with SharePoint 2010

Written by Yves

October 5, 2011

<Disclaimer>This is personal notes of what I retained during the session. This can be incomplete, partially right or wrong. It is just part of the notes I took and what retained my attention. Nothing prevents the user to get more information on their favorite web site.</Disclaimer>

DSC04660MY site is the backbone of the social capabilities of SharePoint. Social is becoming more interesting to companies. Employees connected to a wide range of colleagues generate $83000 more in revenue per year. Social in SharePoint can be achieved starting with the team sites or tagging. It also helps people working together. There are numerous components in SharePoint to support social networking, but, out-of-the-box, it does not look good.

Branding for My Sites is similar to the traditional SharePoint Branding and reuses most of the branding of the general sites. The rule is for you to decide how far you want to brand your My Sites. Again, start with one of the out-of-the-box master pages or from of the Starter Master Pages. The default master page for My Sites is mysite.master. The global navigation should match the branding. Because the mysite.master is based on v4.master, a lot of the branding can be reused.

For the global navigation, leave the inner content arranged normally.

Tip : edit the CSS files on a local VM or on a local server, because it will affect all users.

Changing the global navigation or the sub-navigation bar can be done from the SharePoint UI. To override the global navigation, you need to override the GlobalNavigation delegate control. But it means the creation of a feature for the deployment.

Once the branding is done, it has to be deployed on all the mysites and applied automatically. The steps are : Create a feature for move the files where they need to go, Create a feature receiver to switch the master page, Uuse a feature stapler to ensure that when the personal site is created, the branding is applied.

Branding feature is scoped at the web level and deploy files to folders and the receiver switches the master page. The deployment feature can be developed outside the My Sites. The switch of the master page has to be done using a feature (code in the FeatureActivated receiver) as well, as the publishing feature is not activated and it is not possible to change the master page from the SharePoint UI. Do not forget to also write the FeatureDeactivated to come back to the original master page.

Controlling the web part deployment can be tricky. An example of the code that does that must run after the default.aspx is created. The solution is creating a server control into the customer master page. At page load, there is a check if it is the 1st time and get a reference to the default.aspx page and get the WebPartManager. Then, it gets the instructions from an XML file and build a hashtable of the web parts and apply the instructions. Finally, it sets a flag to not run again.

If you want to deploy different web parts for different types of users, after getting the WebPartManager, a check of the user profile can be done. Instructions are thus in the XML file.

You May Also Like…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *