Branding My Sites & Person.aspx in SharePoint 2010

While at SharePoint Conference 2011 last week in Anaheim, California, I was asked to participate as the SharePoint Branding Expert at the “Ask the Experts” event. I was asked a few questions that required code to better explain. I already provided code on a fixed footer in SharePoint 2010. Another question came up regarding SharePoint Branding and My Sites. Below I provide some guidance on a way to modify person.aspx in the My Sites site collection.
One of the conference attendees was having difficulties with the layout in their My Sites person.aspx page that loads the public profile of their employees. In particular they wanted to add content or a web part that could not be modified by the end user. What I suggested was simply adding a web part directly into the person.aspx page using SharePoint Designer.

Opening My Sites site in SharePoint Designer

My Sites in SharePoint 2010 is just like any other site in SharePoint, meaning that if you have the correct permissions set up, you can open your My Sites site collection in SharePoint Designer. Once you do this, look in the Navigation Bar under All Files. In the root of your My Sites folder you will see a few aspx pages. The public profile for each of your users is defined by the person.aspx page by default. Open person.aspx and then in Code View, click on Advanced Mode found in the Ribbon, in the Editing section.

Now you can go ahead and update the person.aspx page as required. I have two quick ideas.

Add a web part outside of a web part zone.

This will lock the web part, so that it cannot be modified or removed via the web browser.

Or how about this.

Automatically add a web part to a web part zone

Adding a web part to a web part zone in the person.aspx would make it much easier for an administrator to modify or remove the web part via the web browser. This may or may not be a problem, that is up to you.

The outcome of the two different techniques in my examples would produce a very similar outcome from the perspective of those that visit someone’s Profile page.

Conclusion

Using either a prebuilt web part, or custom web parts, you should have no problems modifying the person.aspx page to meet your needs. You could use the RSS Reader webpart to pull data from many sources, you could pull data from lists, many options are at your disposal. You could also add jQuery and other hardcoded html/css/javascript to provide rotating banners or messages.
There is a catch that you will want to be aware of. This method requires you to add the webparts to the Master Page itself so the account you are using to modify the masterpage would require the proper permissions to write to this file. Along this same line, since you are modifying the Master Page, all users would see the same web parts, you could not use this technique to allow each user to modify the web parts on their profile page.
How have you modified your My Sites site collection? Or what are you trying to do? Please tell me, I and others would like to know.

4 thoughts on “Branding My Sites & Person.aspx in SharePoint 2010

  1. Mark July 26, 2012

    Hi Eric
    Where would you find information like __WebPartID and for the custom web part that you are trying to add?
    I have added the web part in the master page under the Insert->WebPart menu but dont know where to find the information about the web part.
    Thanks!
    Mark

  2. Eric Overfield July 30, 2012

    Hi Mark,
    The value of __WebpartID is dynamically generated by SP. If you add the web part to a page using SPD, remove the __WebpartID key and value and see what happens. Otherwise you could generate your own GUID for the __WebpartID value.

  3. BRM013 October 17, 2012

    Eric,
    I’d be interested to see an example of how you would do this by using a Solution. In most organisations I’ve seen, just jumping in and using SPD is not an option as they want repeatable, testable, maintainable solutions.
    A few years ago I was on a small project where we had to replace the EditProfile.aspx page (long story…) and we struggled with this for a bit. In the end we had to write a bunch of code just to copy the contents from our file over the existing file (or there abouts). In my opinion it was not a good solution, not sure how upgrades will go for them.
    Any suggestions?
    Brett

    1. Eric Overfield October 21, 2012

      Hi Brett,
      Since the person.aspx page is a part of the my sites host site collection I think you could create a site scoped feature, although a web scoped should work as well. This feature when activated could open the person.aspx file, find the proper web part zone and then add the web part. This solution would work for a sandboxed solution as sandboxed solutions do not have access to the web part zone library classes I believe.
      Check out some of the following articles about adding a web part to a web part zone. There is not too much special about the my sites host site collection so the theory should be the same.
      http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/efc2e768-7895-46c4-9b06-ccf78a513f4b/
      Programmatically Moving, Adding, and Removing Web Parts in SharePoint 2010
      Web Part Manager is not available in sandbox:
      http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.getlimitedwebpartmanager.aspx

Leave a Comment

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

Enter Code *

Filed Under

Related

Are you preparing to launch a new #SharePoint #intranet?

Don’t spring it on employees out of the blue. First, talk to as many of them as you can.

Planning is just phase one. For all of our tips, watch our recent webinar with @EricOverfield!

https://pixelmill.com/webinar-recap-9-takeaways-from-a-migration-to-sharepoint-online/

Are you preparing to launch a new #SharePoint intranet?

Don’t spring it on employees out of the blue. First, talk to as many of them as you can.

Planning is just phase one. For all of our tips, watch our recent webinar!

http://ow.ly/dsQM50GqPI5

It's that time again! Join #Microsoft MVP & Regional Director, @EricOverfield on Thursday, October 28th, at 11:00 AM PST as he walks through #MicrosoftViva’s current state & offerings and what they mean to your #digitalworkspace right now.

http://ow.ly/3QFK50Gnx9f

It's the final countdown! Join @EricOverfield at 11am PST to learn about common pitfalls and paths to success when moving to #SharePointOnline. You'll walk away with practical tips to use in your organization today!

http://ow.ly/fdf150GjyJT

In today's episode of the #PixelMillWebinars, you'll learn from the experience of a global organization’s path to digital teamwork victory and get to see first-hand how to successfully plan a smooth migration for your team.

Join us at 11am PST!

https://pixelmill.com/webinar-9-takeaways-from-a-global-organizations-migration-to-sharepoint-online/

Subscribe to PixelMill's
E-news

* indicates required

Let's Talk Digital
Workspaces Today

Get In Touch