Thursday, September 30, 2010

My Site Branding in SharePoint 2010

I found a nice post on branding My Sites in SharePoint Server 2010 here.  I took it next step and have provided the source code for a feature staple to update the global navigation for branding your SPS 2010 My Sites.

This solution contains sample branding to be implemented to the My Sites host template and personal site template.   This branding is simply implemented for sample purposes and is not a full-fledge, tested, production-ready branded interface.


It was developed as a Feature Staple packaged in Visual Studio 2010.   The Global navigation utilized in the My Sites templates loads from a User Control which cannot be modified via master page updates in SharePoint Designer – thus the feature staple.

The feature staple solution for this customization was built with following components:

  • New user control (XYZMysiteNav.ascx).  This user control is copied from existing GlobalNavigation user control.  This new control adds reference to a new CSS file and three new <div> tags.  The new <div> tags are used to accept placement of the header consisting of three images.  New control deployed to web server folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\xyzmysites.
  • A new feature (XYZ.MySiteFeatureStaple_XYZ_MySiteBrand).  This feature binds the new user control to the existing user control and is deployed to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\XYZ.MySiteFeatureStaple_XYZ_MySiteBrand.
  • Custom CSS (xyz_mysites.css):  This CSS file contains updated styling for the new <div> tags and updates to positioning, colors, and fonts for existing SharePoint IDs and Classes.  This CSS is mapped to folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\STYLES for deployment.
  • Custom images:  A variety of images used for header, logo, background, and webpart titles referred to in above CSS file.  The images are mapped to folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\xyzpilot for deployment.
  • Feature Staple (XYZ.MySiteFeatureStaple_XYZ_MySiteStaple).  Feature staple is used to staple the feature mentioned above (XYZ.MySiteFeatureStaple_XYZ_MySiteBrand ) to the Personal Site (SPSPERS) and the My Sites Host (SPSMSITEHOST) site templates and is deployed to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\XYZ.MySiteFeatureStaple_XYZ_MySiteStaple

The above solution is packaged into a SharePoint solution file (XYZ.MySiteFeatureStaple.wsp – grab from debug folder if you want to deploy to see what it does) and deployed to the web application hosting my sites where it is activated on the My Site Host site collection.

Through feature stapling, the feature is automatically enabled on new personal sites which are created but for all existing sites, the feature has to be activated by running the script below from the SharePoint PowerShell Command prompt on the WFE server (brandpersonal.ps1 powershell script can also be found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\xyzmysites):


$personalSites = get-spsite | where {$_.RootWeb.WebTemplate -eq "SPSPERS"}

foreach ($site in $personalSites) {Enable-SPFeature -Identity "MyNewNavFeature" -Url $site.Url}



Download source code from this link.

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. A professionally crafted corporate logo designer is one of the greatest blessings for a company; whether it is big or small. It gives them an identity of their own and makes them different from others.

    ReplyDelete