Udostępnij za pośrednictwem


Customizing My Sites in Microsoft SharePoint 2010

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 https://technet.microsoft.com/en-us/library/cc262716.aspx ) :

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="1.0.0.0"
Hidden="TRUE"
Scope="Web"
xmlns="https://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>

Example elements.xml:
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<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 https://<mysitehost> (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. Please let us know if you have any questions, and we would be glad to help you out.

-- Aditi (from the Microsoft SharePoint 2010 Social Computing team)

Comments

  • Anonymous
    June 07, 2010
    I've come across another method for doing this, using event handlers: philwicklund.com/.../new-event-handlers-in-sharepoint-2010.aspx. It seems simpler, less arduous than feature stapling, but would it result in an supported scenario? Thanks

  • Anonymous
    June 14, 2010
    hope you can help me out.. on the right drop down menu .. "My profile" link is missing.. how to get it back How to add for example "My Test" in the top ribbon next to "My Link" ? also the top bar in the site settings is missing ? how do it get it back ? Neel

  • Anonymous
    June 17, 2010
    Chris, Using the site provisioning event handler is also another possible approach.  The one big drawback I can see with this is that once the site is provisioned, your code becomes inaccessible unless your re-provision the site.  Using a feature (with stapling) allows you the deactivate and reactivate the feature and  hence force, run your code. I've used the feature stapling code in 2010 and it works fine.  One thing I can comment is that you might want to set the master page file as "Ghostable" and not "GhostableInLibrary" in the feature elements.  This way, if you redeploy the solution with a newer version of the master page, my sites already provisioned will also be updated since it will be using the ghosted master page on the file server and not the one in the Master Page Gallery. Yohan

  • Anonymous
    June 25, 2010
    Come to think of it, the site provisioning events are raised when a site is created on a site collection... not when a site collection is created.  Since the personal My Site is a site collection on it's own, this is not a viable option.

  • Anonymous
    July 23, 2010
    and Yohan how do u do with outlook inbox and calender ,contacts? otherwise good article regards superduber newbie

  • Anonymous
    July 27, 2010
    The comment has been removed

  • Anonymous
    September 09, 2010
    With reference to the following... •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. On person.aspx I don;t see the Site Actions menu. If I goto my profile page I see it, but under Look and Feel I don;t see the 'Top Link Bar' listed. Any ideas ?? Ian
  • Anonymous
    October 04, 2010
    Hi I am wanting to remove the My Sites option from our sharepoint site and only leave the shared site. Can you please tell me how to go about doing this? Thanks I hope you can help me

  • Anonymous
    October 07, 2010
    Thansk for the blog. I have two populations and I want to manage the permissions of overview(person.aspx), orgnization, content pages. for exemple, for one group, they can't see the organization page. is it possible?

  • Anonymous
    October 14, 2010
    Good info. It seems like for Sharepoint 2010 editing the master page for the appropriate My Site Host page would be the way to add a web part for a list of the users [Me] tasks (a DVWP showing all tasks on all team sites the user is a member of).  Am I right?

  • Anonymous
    November 27, 2010
    The comment has been removed

  • Anonymous
    December 20, 2010
    Doshi, I need to add a webpart or a link in Mysites to be available to all the mysite owners, how do i do that? For exampe, add igoogle using Content editor Web part, and it should be available to every mysite owner when they sign in. Please let me know Thank you Neel

  • Anonymous
    January 14, 2011
    The comment has been removed

  • Anonymous
    March 01, 2011
    Do you know how can I include a logo to replace the "My Site" link on the top of the page? I'm planning in making My Sites the center of our intranet and branding My Sites is been a nightmare so far. Thank you!

  • Anonymous
    April 13, 2011
    Does anyone know of a good walkthrough covering feature stapling for MySites in Sharepoint 2010? I am fairly new to sharepoint development and while there is a lot of information for feature stapling in SP2007, none of it seems to be updated for SP2010. Thanks, Matt

  • Anonymous
    April 20, 2011
    wonderful article!! but is there a way to add the control as a tab in global navigation bar?

  • Anonymous
    June 27, 2011
    Hi, Thanks for nice article, Do you know how to add webpart for all user in my site?  Like I want to  view  OWA  for all user in my site.

  • Anonymous
    July 05, 2011
    Thanks for the great tips on branding My Sites; it was very helpful to me. There is a typo in the code (and I didn't see any other comments about this):  The attribute "Controlsrc" in the elements.xml should be "ControlSrc".

  • Anonymous
    July 17, 2011
    Hi, I want to remove the Personal Documents,Shared Documents and REcent Blogs webpart which will be displayed by default when we navigate to MyContent on SharePoint 2010 MySites.Since this site collection would be created when the user clicks on MyContent Link for the first time,I am not sure How can we get reference to this sitecollection using SPWeb object.Could you please provide me the steps to resolve this Thanking you in anticipation

  • Anonymous
    September 26, 2011
    checkout this one. maulikdhorajia.blogspot.com/.../sharepoint-2010-enabling-target.html

  • Anonymous
    October 16, 2011
    The comment has been removed

  • Anonymous
    November 04, 2011
    i got a nice post about same. maulikdhorajia.blogspot.com/.../sharepoint-2010-get-my-personal-site.html

  • Anonymous
    November 11, 2011
    Is there an easy way to set permissions for lists and libraries on the My Site? Now I go into the permissions for each and set them as needed. It would be nice for a shorthand method for a small set of SharePoint groups or mybe based on MyTeam and MyColleagues....

  • Anonymous
    January 02, 2012
    Hi, I am creating sub-site with template "Personalization site" in 2010. But it give error about feature Id. Can any one will help me...?????

  • Anonymous
    January 04, 2012
    Swen W, did you find out any info if it is possible and how to edit those privacy levels in profile (My Manager, My Colleagues)?

  • Anonymous
    January 27, 2012
    I've seen a few references to editing the Person tabs via the Quick Launch.  However, my site seems to have Publishing Infrastructure turned on so this is not available.  Not sure if I turned this on at some point or that is the default. Also, what is the best way to get a Portal Site Connection worked into the navigation?

  • Anonymous
    February 23, 2012
    Hi Gaurav, Nice article and very informative... I want to show all information without "More Information" link button in the mysites by default. How can i do that? Thanks, Sudheer.

  • Anonymous
    October 18, 2012
    this site is retarted!!!!!!!!!!!!!!!!!!!!!!

  • Anonymous
    February 21, 2013
    Why use feature stapling in the section: "Customizing the Look and Feel"

  • Anonymous
    July 14, 2014
    Hi All, I have a site http://servername:8181/pages/home.aspx, when I search people from mentioned site i get people search results. When i click any user it redirects to (http://servername:80/my/person.aspx) 80 port  my site. I need to display profile page of user within the same port 8181 from the people search results. Can anybody help me to resolve this. Thanks.