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

Do you need to build a custom search-driven component for your #digitalworkspace while saving thousands of hours of development time?

Join us on as we lift the hood of #PnP Modern Search v4, show you how it's built, & take you on a live coding adventure.

http://ow.ly/MTnL50EpN5J

#Hybridwork is more than just a buzzword to latch onto; it’s the future for many organizations for the unforeseeable future. So, how can you use #Microsoft365 for #hybridwork? Let's breaks it down…

http://ow.ly/ay2e50EmNhg

It's that time again! Join the #PixelMillWebinars on 4/29 where @EricOverfield lifts the hood of #PnP Modern Search v4, shows how it's built, & takes you on a live coding adventure to customizing your own web part using the power of the existing codebase.

http://ow.ly/EI5h50EmNqj

What? Anchor links now work in #SharePoint site navigation! This fix snuck in and I completely missed it. Use them to create a TOC for long pages or cross link between pages. They work in text or quick links web parts & nav too! https://support.microsoft.com/en-us/office/create-and-use-modern-pages-on-a-sharepoint-site-b3d46deb-27a6-4b1e-87b8-df851e503dec#bkmk_pageanchors

A big thank you to David Leveille and @CrushNetworks for having our President + Co-Founder @EricOverfield on this episode of #TheVirtualWaterCooler!

Subscribe to PixelMill's
E-news

* indicates required

Let's Talk Digital
Workspaces Today

Get In Touch