Customizing My Sites in Microsoft SharePoint 2010

Customizing My Sites in Microsoft SharePoint 2010

Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\<Locale ID>\It is below this folder that all the area templates that drive the creation of a portal live, below is a brief summary of each of the folders and the templates that belong to them:

My Site Homepage
My Site Team Site
News Home
Site Registry
Topics Home
WSS Team Site
WSS Multi-Page Team Site

This post is not about going through in detail how to modify a template, there are documents rolling out the door at Microsoft that cover this. The only thing I did want to clarify is how you go about modifying the “My Site” template. This is a little “non-intuitive”, mainly because this is the only aspect of the portal that is actually controlled by two templates:

My Site Homepage
My Site Team Site

So what’s the difference between these two templates? SPSMSITE – This is just like any other SPS Portal Area and it is from here that both the “Private” and “Public” views of a “My Site” is rendered. Your “My Site” view is nothing more that just a personalised view of an area, much like you can enable on any area of the Portal if you like (Hmmm…idea for another post!). This explains why you can modify the layout of the “My Site” page for all users by accessing the page as an administrator and modifying the “Shared View”. When you look in the template directory you will see Default.aspx (this is your private view) and Public.aspx (Your private view). SPSPERS – This template is all about provisioning the “Team site” that sits behind your “My Site”. The one behind SPSMSITE couldn’t be used as that would mean one team site would be shared by everyone, this approach is used so that everyone has their own individual team site. To summarise. – If you want to modify the Public/Private pages in “My Site” use the SPSMSITE template, changes to the ONET.XML file will have no effect because noone ever gets to team site it creates (it’s hidden, and no I dont know how you might access it, never really looked into it, let me know if you find a way). – If you want to change what lists, and the properties of those lists, for you “My Site” site then modify the ONET.XML file in SPSPERS (note this is at your own risk, review supportability constraints in the SDK) modifying the default.aspx page in this template has no effect as it is “hidden”.

One of the most common question we get from customers is: “How should we customize My Sites?”. Different customers have different needs, but we saw a few common trends. So, we decided to put up a post to help you with common questions such as: – How do I change the top navigation on My Sites to include other links? – How do I brand My Sites? – How to add a customization to all existing personal sites? – How do I use personalization sites?
Let’s go through some of these steps now:

1. The global top navigation bar

The global top navigation bar appears on every My Site page (on both the personal and public site) to provide a uniform navigation experience throughout the portal.

  • Customizing the links

It is very easy to add or remove links on the global navigation and also to edit their display text and/or the address URL. As a site admin of the MySiteHost site collection, follow these steps:

1. Visit any page under the MySiteHost (like <mysitehost>/person.aspx) and click Site Actions –> Site Settings

2. Click on “Top link bar” under the “Look and Feel” section to add, remove, edit or reorder the links.

  • Add Personalization Site links to global navigation

As in 2007, you can create “personalization sites” and configure these links to show up on the My Site global navigation bar for the users in the Target Audience. Here are some steps to do this (the basic idea remains the same as described in ) :

1. Create a personalization site by selecting Site Actions –> New Site, and choosing the “personalization site” template under the Enterprise tab.
2. Go to Central Administration –> Manage Service Applications –> User Profile Service Application –> Manage. In the Manage Profile Service page, go to “Configure Personalization Site” under “My Site Settings”. Create a “New Link” with the URL of the above site and scoped to a previously compiled Target Audience.
All members in the Audience will see a link for the personalization site pinned to their global navigation bar, like this:
The users can also visit a personalization site and add the site to their top navigation by clicking the “Pin this site” menu item, as below: Users can remove these user-pinned personalization site links from their My Site top navigation, by selecting the “Unpin this site” option:

  • Customizing the Look and Feel

We have a DelegateControl on our masterpages to hold the top navigation control. To customize the global nav area more deeply (for example, change the layout or add/remove some controls), you will need to create a new feature to bind your customized navigation control to this DelegateControl.
1. Under %Program Files%\Common Files\Microsoft Shared Debug\Web Server Extensions\14\TEMPLATE\FEATURES, create a new folder for your new feature, say MyNewNavFeature.
2. Under the MyNewNavFeature folder, create a feature.xml file to define a web feature that points to elements.xml, and an elements.xml file that binds the “GlobalNavigation” DelegateControl to a new ascx file (say, newtopnavigation.ascx) under controltemplates. Make sure that the Sequence attribute is set to a value < 100 so that this feature overrides the OOB navigation control.
Example feature.xml: <Feature Id=”<new guid>”     Title=”My Feature”     Description=”New Nav Feature”     Version=”″     Hidden=”TRUE”     Scope=”Web”     xmlns=””&gt;     <ElementManifests>         <ElementManifest Location=”elements.xml”/>     </ElementManifests> </Feature>

Example elements.xml: <Elements xmlns=””&gt;   <Control Id=”GlobalNavigation” Sequence=”10″ Controlsrc=”~/_controltemplates/newtopnavigation.ascx” /> </Elements>
3. Create the newtopnavigation.ascx file under Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES. You can start with a copy of our out-of-box MySiteTopNavigation.ascx and tweak the styles and controls to suit your need.
4. Use feature stapling to staple this new feature to SPSPERS and SPSMSITEHOST site templates. You can run the following commands from powershell to install and enable your new feature:
a.       Install-SPFeature -path “MyNewNavFeature” b.       Enable-SPFeature -identity “MyNewNavFeature” -URL http://<mysitehost&gt; (Enables the new feature on the mysitehost) c.       Enable the new feature on all personal sites:

$personalSites = get-spsite | where {$_.RootWeb.WebTemplate -eq “SPSPERS”} foreach ($site in $personalSites) {Enable-SPFeature -Identity “MyNewNavFeature” -Url $site.Url}

2. The public page sub-navigation bar

Out of box, the sub-navigation bar appears on the 6 key profile pages and helps navigating between these pages easily.

  • Customizing the links

Again, it is very easy to add or remove links from this navigation and also to edit their display text and/or the address URL. As a site admin of the MySiteHost site collection, follow these steps:

1. Visit any page under the MySiteHost (like <mysitehost>/person.aspx) and click Site Actions –> Site Setting

2. Click on “Quick Launch” under the “Look and Feel” section to add, remove, edit or reorder the links.

  • Customizing the Look and Feel

To change the CSS styles on this menu, just override our default styles for .s4-sn defined in mysitelayout.css. If you want to change something on the control, edit each of the 6 profile pages in SPD and update the AspMenu control with ID=MySiteSubNavigationMenu.

3. Customizing the master pages and webparts

Customizing the master pages and webparts remain mostly identical to that in 2007.

  • Customizing the My Site Host

The public/profile pages (My Newsfeed, My Profile and other sub-navigation pages) belong to the My Site Host site collection.

The My Site Host uses use the mysite.master masterpage by default. To edit the out-of-box masterpage, you can open the site in SPD and edit the masterpage.

If you want to use your own masterpage, upload the new masterpage to the site’s Master Page Gallery under Site Settings. From Site Settings, enable the “SharePoint Server Publishing” feature under both “Site Collection features” and “Manage Site features”. This will add a “Master Page” link under the “Look and Feel” section and you can visit this link to apply your newly uploaded masterpage to the site.

To add or remove webparts from any of the My Site Host pages, the site admin could just manually add/remove appropriate webparts using the UI. This would be a one-time configuration step and all users will see this change since the My Site Host site collection is shared across all users. Of course, you can do this programmatically too.

  • Customizing the personal sites

The “My Content” link takes the user to their personal site, which is a different site collection than the My Site Host.

The personal site uses the v4.master masterpage by default. Each user is the owner of their own personal site, and can follow the above steps to customize the masterpage on their individual sites. If the admin wants to customize the masterpage on every personal site, feature stapling is the way to go. The same holds true for adding/removing webparts on the personal site. Each user can use the site web part adder to add new webparts to his personal page. If the site admin wants to add/remove/preconfigure webparts on each user’s personal site, they’ll need to use feature stapling.

We sincerely hope that you will find this helpful as you start rolling out My Sites, as a part of Microsoft SharePoint 2010 deployment at your enterprise


About sharepointsriram

9+ Yrs of IT experience
This entry was posted in Sharepoint 2010 Central Administration. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s