SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

Automatically applying a My Site master page to a site when it is created

I wanted to create own customized My Site. By default My Sites is created on default.master page. Even though sharepoint admin try to change the default.master page, he found that it is not inherit from the Portal Home.

What is the best approach to customize?

You have to modify the default.aspx file in SPSPers to use Custom.Master page to get the My Profile view to use a single master page; it is not inherited from the Portal home.  There are only 2 settings, default.master or custom.master.

You need to create a new master page and place it in the SPSPers directory and then modify the ONET.XML by adding a reference in the configuration to use your page

Step 1 – Create My Site Template

1.       Create a My Site using any account

2.       Make myMaster.master using default.master, which is located under _catalogs/masterpage

3.       Customize U/I using copied master page

4.       Copy this myMaster.master into C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL

Step 2 – Customize  default.aspx

1.       Change directory to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\SPSPERS

2.       Open default.aspx using Sharepoint Designer 2007

3.       Change master page like shown below

From ‘MasterPageFile="~masterurl/default.master"’      to ‘MasterPageFile="~masterurl/custom.master" ‘    

Step 3 – Customize  ONET.XML

<Configuration ID="0" Name="Default" CustomMasterUrl="_catalogs/masterpage/myMaster.master">

Add a new module

<Module Name="CustomMasterPage" />

and in the modules section, add

<Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE">

      <File Url="MyMaster.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />

    </Module>

Step 4 – Reset IIS

For the changes to take affect, you will need to reset the IIS.    

 

example ONET.XML

<?xml version="1.0" encoding="utf-8" ?>       
<Project Revision="3" SiteLogoUrl="/_layouts/images/mysite_titlegraphic.gif">
    <NavBars>  
    </NavBars>

    <ListTemplates>
    </ListTemplates>

    <DocumentTemplates>     

    </DocumentTemplates>

 <Configurations>
    <Configuration ID="-1" Name="NewWeb">

</Configuration>  

    <Configuration ID="0" Name="Default" CustomMasterUrl="_catalogs/masterpage/myMaster.master">            
 </Configuration>
             
 <Configuration ID="1" Name="Blank">
        <ExecuteUrl Url="_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/settings.aspx" />
 </Configurations>
 <Modules>
     <Module Name="Default" Url="" Path="">
       </Module>
     <Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE" SetupPath="global">
      <File Url="myMaster.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />
    </Module>

  </Modules>
</Project>


Posted 02-23-2007 9:12 PM by Unclaimed Blog

Comments

Sai wrote re: Automatically applying a My Site master page to a site when it is created
on 10-08-2007 5:21 AM

Give me details completly to which Onet.xml we should change.

Tina wrote re: Automatically applying a My Site master page to a site when it is created
on 10-18-2007 6:03 PM

It does not work .... no change in mysite ... what so ever .... I follwed exact steps, but did not work.

gcadena wrote re: Automatically applying a My Site master page to a site when it is created
on 12-11-2007 12:18 PM

I have the same problem mysite no change, also i reviewed the code and don´t understand why de CustomMasterUrl is differente from  C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL

where copied myCustom.master

Ilam wrote re: Automatically applying a My Site master page to a site when it is created
on 01-17-2008 11:09 AM

Hi :

Do you know how can I delete Web Parts by default in My site, So that I could not see this web part in the Add Web Part List when edit a Web Part Page?

Thank for your help

Cees wrote re: Automatically applying a My Site master page to a site when it is created
on 01-20-2008 7:40 AM

Since you talk about _catalogs/masterpage, I assume you do step 1.2 with SP Designer. If so, you get a new masterpage in the database. How are you going to copy that one to a filesystem folder (step 1.4), since it doesn't even exist on the filesystem yet?

You talk about myMaster.master, in step 2.3 you suddenly refer to custom.master. Which is it?

Manpreet wrote re: Automatically applying a My Site master page to a site when it is created
on 02-05-2008 11:24 PM

Hi,

I did follow all abov step. but i am able to see the changes

Matt wrote re: Automatically applying a My Site master page to a site when it is created
on 02-26-2008 9:54 AM

Hey yeon,

thank you for your wonderful advice how to apply a master page do the Mysite.

Unfortunately I ran into some trouble following your description. Mostly it didn't work because I didn' read the instructions carefully.

But at some places it is also a bit misleading, so to avoid others to have the same trouble as I had here what I've learned:

Step 1:

Everything clear so far:

I placed a copy of the "default.master" Page from the _catalogs/masterpage under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\myMaster.master

Step 2:

In this step I made follwing mistake:

I changed 'MasterPageFile="~masterurl/default.master"’ to ‘MasterPageFile="~masterurl/myMaster.master"' instead of the recommended ‘MasterPageFile="~masterurl/custom.master"'

As I said, reading the instructions carefully is important ;-)

Step 3:

This one caused me the most trouble as your description is inconsitet with the onet.xml in Step 4:

First of all, for everybody who is wondering which onet.xml has to be modified, use the one under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\SPSPERS\XML\

Second:

Change

<Configuration ID="0" Name="Default">

to

<Configuration ID="0" Name="Default" CustomMasterUrl="_catalogs/masterpage/myMaster.master">

Third:

Still in <Configuration ID="0" ...> got to the subsection  <Modules>

and add <Module Name="CustomMasterPage"/> right after <Module Name="Default"/>

(you forgot this in your sample onet.xml)

Fourth:

At the end of onet.xml add

<Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE" SetupPath="global">

     <File Url="MyMaster.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />

</Module>

in the modules section.

It is very important that you use the attribut 'SetupPath="global"'

( you forgot this on in Step 3)

Then run iisreset an all new sites which are created use the new masterpage

To delete existing MySites user following command in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

directory on the server:

stsadm -o deletesite -url spswebname/.../username

So here for everybody my working onet.xml file:

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

<Project Revision="3">

   <NavBars>

...

   </NavBars>

   <ListTemplates>

   </ListTemplates>

   <DocumentTemplates>

...

   </DocumentTemplates>

<Configurations>

   <Configuration ID="-1" Name="NewWeb"/>

   <Configuration ID="0" Name="Default" CustomMasterUrl="_catalogs/masterpage/rundsmysite.master">

       <Lists>

...

       </Lists>

       <SiteFeatures>

...

       </SiteFeatures>

       <WebFeatures>

...

       </WebFeatures>

       <Modules>

           <Module Name="Default"/>

   <Module Name="CustomMasterPage"/>

       </Modules>

   </Configuration>

   <Configuration ID="1" Name="Blank">

       <ExecuteUrl Url="_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/settings.aspx" />

   </Configuration>            

</Configurations>

<Modules>

    <Module Name="Default" Url="" Path="">

        <File Url="blog.xsl"></File>

        <File Url="default.aspx" Type="Ghostable">

...

        </File>

   </Module>

<Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE" SetupPath="global">

     <File Url="rundsmysite.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />

   </Module>

 </Modules>

</Project>

UroZ wrote re: Automatically applying a My Site master page to a site when it is created
on 03-31-2008 3:25 AM

Hello,

I am getting an error after I implemented your solution for this  "myMaster.master". The error is like this:  

"ERROR:

Cannot complete this action.

Please try again. "

I tried both version (Matt's and yeon's) and non of them worked.

Any suggestions on how to change the default.master so that any my site user will have this default.master on his site?

Please help.

Thanks

UroZ wrote re: Automatically applying a My Site master page to a site when it is created
on 03-31-2008 3:42 AM

Ok I have successfully remove this error (i forgot on one </Module>). But still this code doesn't work. New users still don't have the right master page. I know that because when I look in the master page there aren't this two tags that i want to be included in every users my site page.

Please help how to do this.

Thanks

ricky wrote re: Automatically applying a My Site master page to a site when it is created
on 04-13-2008 11:50 PM

i already followed all the instructions but i got this error "File not found".

anyone can help me...

thanks

Dave wrote re: Automatically applying a My Site master page to a site when it is created
on 04-15-2008 5:13 PM

This site describes the MS supported way of customizing MySites: blogs.msdn.com/.../customizing-moss-2007-my-sites-within-the-enterprise.aspx

Matt's directions are good for customizing other site definitions besides MySites.

Dave wrote re: Automatically applying a My Site master page to a site when it is created
on 04-15-2008 5:15 PM

Ricky,  

Your error pertains to the masterpage not being found. Either its not in the correct folder on the file system(12 hives), or in the correct masterpage gallery.

aby wrote re: Automatically applying a My Site master page to a site when it is created
on 10-30-2008 7:46 AM

Hi,

I'm getting the error "File not found".

Please Help ......

Thanks,

aby wrote re: Automatically applying a My Site master page to a site when it is created
on 10-30-2008 12:12 PM

Hi,

Now am getting error :

Microsoft.SharePoint.SPException: Failed to instantiate file "mysite.master" from module "CustomMasterPage": Source path "mysite.master" not found. --->

Please help.......

Flincorp wrote re: Automatically applying a My Site master page to a site when it is created
on 11-05-2008 3:28 PM

Is this for SPS 2003 and MOSS 2007 or only for SPS 2003???

This is probably the problem if u try this on MOSS 2007...

Mike Medowski wrote re: Automatically applying a My Site master page to a site when it is created
on 11-22-2008 5:16 AM

It's MOSS2007 Fincorp. This worked a treat  for me thanks, really useful.

This is a wonderful example  of a public facing exposed website built in Sharepoint. It's for Sheffield LEP (BSF SHeffield)

www.sheffieldbsfschools.com

Vijay wrote re: Automatically applying a My Site master page to a site when it is created
on 12-17-2008 3:30 PM

Did not work. I followed another approach, by creating a feature with Staplee & Stapler along with EventReceiver this worked like a charm.

Theme My Profile | keyongtech wrote Theme My Profile | keyongtech
on 01-18-2009 10:40 AM

Pingback from  Theme My Profile | keyongtech

Gino Ferrat wrote re: Automatically applying a My Site master page to a site when it is created
on 01-26-2009 5:02 AM

¬Hi Mike ...Yes a really net design - nicely done !www.sheffieldbsfschools.com

Saurabh Kumar Singh wrote re: Automatically applying a My Site master page to a site when it is created
on 05-04-2009 12:46 PM

Hi,

I am creating a Community Site in MOSS 2007 with customization and also want to use existing My Site(basically “My Pofile”) feature for each user’s profile like ORKUT fashion(which maintains GROUPS, FRIEND’s List, SCRAPBOOK, MESSAGES etc.). Can i use “My Site” feature of this purpose??

Can you please help me in this context??

Thank you,

Saurabh

E-mail: saurabhsinghmca@gmail.com

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.