i:0#.w|Ali.Mazaheri

SharePoint, SharePoint and SharePoint!

Developing a custom MySite host site definition using VSeWSS 1.3

Developing a custom MySite host site definition using VSeWSS 1.3

  • Comments 13

In MOSS 2007 as part of the SSP provisioning process “SPSMSITEHOST” site definition is being used to provision the MySite host (Root site) which provides access to user profile information through “person.aspx” and “SPSMSITE” site definition used to provision a personal site collection for each individual user.

One thing to consider is while each user owns a seperate site collection as personal site, MySite host is shared among all users and changes to “Person.aspx” will affect all users. Feature Stapling is my method of choice for customizing or extending the OOB “SPSMSITE” features as explained in this great post by Steve Peschka. As for customizing the MySite host, in most cases changes should be applied directly to “Person.aspx” file or the related "ONET.XML”. As best practice it is always recommended not to modify the OOB site definitions and although SharePoint Designer can be used to apply changes to “Person.aspx”(which leaves the page as un-ghosted) in scenarios where changes should be deployed from one environment to another (e.g. from Development to QA and eventually Staging and Production) leveraging a custom site definition wrapped in a solution package is a better approach.

Following explains the steps to create and deploy a custom MySite host site definition based on the OOB “SPSMSITEHOST” site definition using Visual Studio 2008 extensions for Windows SharePoint Services v 1.3 and STSADM command:

  1. Create a new project using “Blank Site Definition” template 
    image
  2. In VS 2008 copy over “ONET.XML”, “Person.aspx”, “Default.aspx”, “Discussion.aspx” and “Blog.xsl” files from “12\Templates\SiteTemplates\SPSMSITEHOST” folder under “CustomMSITEHost"\Site Definition”
    ScreenHunter_03 Feb. 18 14.58
     
  3. Make sure to add the required namespaces to the <Project> element in the new “ONET.XML” file and change other sections if required

    ONET.XML

    <?xml version="1.0"?>

    <Project  Revision="2" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/" SiteLogoUrl="/_layouts/images/mysite_titlegraphic.gif">

    </Project>

  4. Change the “ID” value from 1 to 0 in “WebtempCustomMSITEHOST.XML” so it references the default configuration in “ONET.XML”

    webtempCustomMSITEHOST.XML

    <?xml version="1.0" encoding="utf-8"?>

    <Templates>

      <Template Name="CustomMSITEHOST" ID="10001">

        <Configuration ID="0" Title="CustomMSITEHOST" Description="" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" DisplayCategory="Development" />

      </Template>

    </Templates>

  5. Modify the “Person.aspx” file (In this example a border attribute is added to the html table for “Business Card” section)

    Person.aspx

    <!-- business card -->

    <table cellspacing=0 cellpadding=0 width="100%" style='table-layout:fixed;word-wrap:break-word;' border=”1”>

    <tr>

    <td class="ms-vb ms-announcementtitle ms-profilevaluelarge" id="ProfileViewer_ValueTitleDept">

     <SPSWC:ProfilePropertyValue PropertyName="Title" class="ms-profilevalue" runat="server" /><SPSWC:ProfilePropertyCheckValue PropertyNames="Title,Department" runat="server" Text=", "/><SPSWC:ProfilePropertyValue PropertyName="Department" class="ms-profilevalue" runat="server" />

    </td>

    </tr>

    <tr>

    <td class="ms-vb ms-announcementtitle" id="ProfileViewer_ValueOfficePhone">

    <span class="ms-profilevaluesmall"><SPSWC:ProfilePropertyValue PropertyName="Office" class="ms-profilevalue" runat="server" /><SPSWC:ProfilePropertyCheckValue PropertyNames="Office,WorkPhone" runat="server" Text=" &nbsp; "/><SPSWC:ProfilePropertyValue PropertyName="WorkPhone" dir="ltr" class="ms-profilevalue" runat="server" /></span>

    </td>

    </tr>

    <tr>

    <td valign=top class="ms-descriptiontext" id="ProfileViewer_ValueAboutMe">

  6. Switch to WSP view and make sure that all the elements and files included in solution package
    ScreenHunter_07 Feb. 20 14.19

  7. From “Solution Explorer” tab, build and deploy the package
       ScreenHunter_11 Feb. 20 21.39
  8. Confirm that the solution package has been deployed successfully, at this point "My Profile" information should be displayed via OOB “Person.aspx”
    ScreenHunter_10 Feb. 20 21.37
  9. Delete the root MySite host site collection and provision a new site collection based on the custom template (i.e. CustomMSITEHost)
    ScreenHunter_12 Feb. 20 21.50
  10. Refresh the profile page and notice the change
    ScreenHunter_13 Feb. 20 21.51
  • PingBack from http://www.clickandsolve.com/?p=12748

  • Is there anyway you can zip up your source files and provide a link for us?

  • Where do I find WebtempCustomMSITEHOST.XML??

    An article helpful only to those who already know. Useless for the rest of us though.

  • To James P --

    If you haven't already figured it out, the webtemp file will be in your WSP view (go to View > Other Windows > WSP view -- will appear under your solution explorer if in default area).

  • Ali,

    Great stuff. At first I was afraid this would lose customizations users had made, but apparently that isn't possible!

    One question, any recommendations on the private side of My Sites? Is there similar magic to provision new webparts or sites?

  • I have followed the instructions, however I seem to be missing some steps.

    Is there an example solution I can download?

  • Can i use the feature stappleing method to modify the person.aspx or do I have to use your method to achieve that. Also is there any way to add anothe rpage to mysite what is the way do it feature stappling or the your method.

  • Will this work with VS 2005? I tried it but no luck.

  • Hello,

    I recently ran across your post which got me to the 80% mark on deploying a custom person.aspx feature.

    Using your example, however, when I go to WSP view I seem to be missing Elements section entirely form the view.

    Are you able to post the original code so I can see your underlying project structure to see if I have overlooked something extremely simple.

    Thanks,

    Stephen

  • When I deploy from Visual Studio and check the newly created SiteTemplates folder, it does not include all the other files such as person.aspx, blog.xsl, etc. The only file that gets copied is the onet.xml within the xml folder. Any reason for this?

  • I would check the manifest.xml to make sure all the artifacts are included.

  • Below is my manifest.xml file. Can you provide an example that will include all the necessary mysites files (person.aspx, default.aspx, blog.xsl, etc.)? Thanks!

    <?xml version="1.0" encoding="utf-8"?>

    <Solution SolutionId="1710ca45-8860-4096-822a-e1f5f6ffc588" xmlns="http://schemas.microsoft.com/sharepoint/">

     <FeatureManifests>

       <FeatureManifest Location="SiteProvisioning\feature.xml" />

       <FeatureManifest Location="TCMySiteHostSiteElements\feature.xml" />

     </FeatureManifests>

     <SiteDefinitionManifests>

       <SiteDefinitionManifest Location="TCMySiteHost">

         <WebTempFile Location="1033\xml\webtempTCMySiteHost.xml" />

       </SiteDefinitionManifest>

     </SiteDefinitionManifests>

     <Assemblies>

       <Assembly Location="TCMySiteHost.dll" DeploymentTarget="GlobalAssemblyCache" />

     </Assemblies>

    </Solution>

  • Can I just deploy a custom "Person.aspx" via an Element Module?

Page 1 of 1 (13 items)
Leave a Comment
  • Please add 3 and 7 and type the answer here:
  • Post