in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

tigirry's SharePoint Blog

Custom Site Definition with Custom Master Page for SharePoint Portal Server 2007 (MOSS 2007) and WSS 3.0

As a SharePoint administrator, if you want to customize your SharePoint sites, the first step is to create a custom site definition with a custom master page.

In order to create a new site definition, you pretty must have two options: design from scratch or copy and edit the existing template. The former will be more difficult than the latter. Designing your own site definition from scratch can be quite challenging if you are not comfortable with what you are doing. In this exercise, I will explain the "easy" way to do this.

1. You need to start with copying the existing site template from. On the server computer, browse to "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\" folder. Each folder represents a site definition. Copy STS folder and paste with new name. In this exercise, we are going to name this site definition "Business" so rename it BUSINESS.

2. In this site definition, a custom master page will be used because in the future, you might want to change the master page of thie site definition and not unghost it. To do this, copy "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\default.master" file to "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\BUSINESS" folder with its name changed to businesscustom.master.

3. Open "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\BUSINESS\default.aspx" file with notepad. In the first line, change
    MasterPageFile="~masterurl/default.master"
        to
    MasterPageFile="~masterurl/custom.master"
Doing so will allow the default.aspx file to use the custom master page. Repeat this step for "defaultdws.aspx" file.

4. Open "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\BUSINESS\xml\ONET.XML" file with notepad.

5. Add the following line under <ListTemplates> tag:
     <ListTemplate Name=”mplib” DisplayName=”$Resources:MasterPageGallery;” Description=”$Resources:global_onet_mplib_desc;” SetupPath=”global\lists\mplib” Type=”116” BaseType=”1” Path=”GLOBAL” Hidden=”TRUE” HiddenList=”TRUE” NoCrawl=”TRUE” Unique=”TRUE” Catalog=”TRUE” OnQuickLaunch=”FALSE” SecurityBits=”11” AllowDeletion=”FALSE” AllowEveryoneViewItems=”TRUE” Image=”/_layouts/images/itdl.gif” AlwaysIncludeContent=”TRUE” DocumentTemplate=”100” />

6. Locate the first <Configuration> tag under <Configurations> tag.

7. Change
    <Configuration ID="0" Name="Default">
        to
    <Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/businesscustom.master">
Notice that I am assigning businesscustom.master value to MasterUrl.

8. Locate <Modules> tag under <Configuration ID="0".....> tag and add the following tag under <Modules> tag:
    <Module Name="CustomMasterPage" />

9. Repeat step 6-9 for <Configuration ID="1".....> and <Configuration ID="2".....> tags.

10. Locate <Modules> tag after </Configurations> and add the following lines to <Modules> tag:
    <Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE">
      <File Url="businesscustom.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />
    </Module>
Notice the file url is the assigned to the custom master page.

11. So far, we have successfully created a site definition. All we have to do now is to register this definition to the site definition list. To do this, create "WEBTEMPBUSINESS.XML" file in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML" folder. Notice that there exists "WEBTEMP.XML" file in the folder and we are not editing this file. We are creating a new xml file to register a new custom site definition.

12. Open the file with notepad and insert the following lines:
 <?xml version="1.0" encoding="utf-8"?>
 <!-- _lcid="1033" _version="12.0.4518" _dal="1" -->
 <!-- _LocalBinding -->
 <Templates xmlns:ows="Microsoft SharePoint">
  <Template Name="BUSINESS" ID="5">
     <Configuration ID="0" Title="Business Tools Team Site" Hidden="FALSE" ImageUrl="/_layouts/images/stsprev.png" Description="A Business site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions." DisplayCategory="Corporation">   
    </Configuration>
     <Configuration ID="1" Title="Business Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/blankprev.png" Description="A blank Business site for you to customize based on your requirements." DisplayCategory="Corporation" AllowGlobalFeatureAssociations="False" >
    </Configuration>
     <Configuration ID="2" Title="Business Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/dwsprev.png" Description="A Business site for colleagues to work together on a document. It provides a document library for storing the primary document and supporting files, a tasks list for assigning to-do items, and a links list for resources related to the document." DisplayCategory="Corporation" >
    </Configuration>
  </Template>
 </Templates>
Notice DisplayCategory="Corporation"; this will create a another tag named Corporation and the three items will be inserted to it. You can change titles, descriptions, and imageUrl's based on your needs. Save and close the notepad.

13. Last but not least, do an iisreset for the server to recognize the new site definition.

Comments and feedbacks are welcome. Smile

Comments

 

Tk Ryu said:

Good Work so far!! thanks.

July 3, 2007 10:31 AM
 

kylierose said:

this is really good information so far...... thanks for the share!

btw: there is a typo in the header of this article ;-)

July 4, 2007 1:42 AM
 

Sharepoint link love 07-03-2007 at Virtual Generations said:

Pingback from  Sharepoint link love 07-03-2007 at  Virtual Generations

July 4, 2007 3:16 AM
 

Sharepoint link love 07-03-2007 at Virtual Generations said:

Pingback from  Sharepoint link love 07-03-2007 at  Virtual Generations

July 4, 2007 3:16 AM
 

pauldunlop said:

I've been trying to get my master page file to be set using this method, but I'm always getting an error on site creation. Not really sure what I'm missing.

Any ideas what would cause an Unexpected Error, and halt the rest of the site pages, etc, being created. When you check the settings for the MasterPage within the Site Settings, it says "The site master page setting currently applied to this site is invalid. Please select a new master page and apply it "

Any ideas?

Thanks

July 5, 2007 3:23 AM
 

tigirry said:

pauldunlop,

If you follow these steps correctly and still get an error, I suggest you to check the template ID in step 12. In this manual, I have set the template ID for my custom site definition to be '5' in WEBTEMPBUSINESS.XML file:

<Template Name="BUSINESS" ID="5">.

This ID value must not exist in WEBTEMP.XML file. Check you WEBTEMP.XML file and assign a unique template ID for your custom site definition. Let me know if this solves your problem.

-Tigirry

July 5, 2007 1:05 PM
 

tigirry said:

kylierose,

Thank you for pointing my typo!

-Tigirry

July 5, 2007 1:09 PM
 

kylierose said:

quick question: when i copy across the default.master file from the GLOBAL directory, is it possible to edit this file or does it need to be kept the same to work? i have encountered errors when attempting this, so if it is possible can you provide any simple tips or things to avoid?

July 5, 2007 6:17 PM
 

tigirry said:

kylierose,

The reason why you want to copy the default.master file is to edit the master page without affecting globally. Let's say you want to edit the default.master file in the global directory. By changing this file, every sharepoint site on your server will be affected.

After you copy the default.master file, you can customize the master page and only the new site definition that uses this master page will be affected.

If you want to play with the master page, I suggest you to use SharePoint designer 2007. If I have a chance, I will sometime write some tips for editing the master page.

-Tigirry

July 5, 2007 11:11 PM
 

kylierose said:

@Tigirry > i actually tried editing the copy of the global masterpage file copied to a new custom definition directory. once a new site collection was created with the custom site definition all went well until i tried to view the page and and error message resulted. to overcome this error, i had to perform an iisreset on the server after reverting my custom masterpage back to the default.

any tips you can provide on this would be greatly appreciated. this is by far the best site resource i have come across...

July 6, 2007 12:42 AM
 

kylierose said:

BTW ~ i am actually using a full version of SD2007 to edit CSS and masterpage files. the trouble started when i edited the default masterpage in the custom definition directory...

thanks!

July 6, 2007 12:43 AM
 

tigirry said:

kylierose,

First of all, if you try to edit the custom master page file with SD2007 after you create a site collection, you will be unghosting your custom master page. You may not want to do that. In order to avoid that, you will need to make changes to the custom master page file with SD2007 before you create a site collection OR you need to edit the custom master page file without opening a site on SD2007. If this is not clear, let me know. I will explain again.

Here are some rules for editing the master page. You cannot erase or edit the following tags in the master page. If you do, you will get an error for sure.

In HEAD section:

<asp:ContentPlaceHolder id=PlaceHolderPageTitle runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>

In BODY section:

<WebPartPages:SPWebPartManager id="m" runat="Server" />

<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">

<asp:ContentPlaceHolder id="PlaceHolderPageImage" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">

<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />

<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server">

<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server"/>

<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server">

These ContentPlaceHolders must be included in the master page. For example, you can erase the whole contents excepts these tags and your master page will work (some styles, icons and menus will be gone tho). Also, you have to obey the xml tag rules. Hope you enjoy editing the master page!

July 6, 2007 11:02 AM
 

Mike Walsh's WSS and more said:

July 8, 2007 3:02 AM
 

pauldunlop said:

Tigirry,

Sorry for the slow response. I didn't spot you'd replied until just now! Doh. I've had a look at what you suggested, I don't think this will be the issue. My ID is 10001. I did it a while back, before I found this entry, and just picked something I thought nothing else would have.

The site actually creates fine. I've got it creating all my pages, with all the webparts on, and properly configured. It's just when I come to add in any information to do with setting what master page the site uses, it breaks with this error. Very frustrating. Have totally run out ideas on this one :-(

July 10, 2007 4:09 AM
 

Shiva Kumar S said:

You have mentioned wrong ".master" name in the step 3.

The new master file name is supposed to be "businesscustom.master" where as you have mentioned it as "custom.master".

   MasterPageFile="~masterurl/default.master"

       to

   MasterPageFile="~masterurl/custom.master"

Hope this helps...

July 12, 2007 12:16 AM
 

pauldunlop said:

No, I think he's done it right actually. I thought that when I first started playing, but it should actually be custom. Then you tell sharepoint what the custom master is

July 13, 2007 9:35 AM
 

yourmom said:

Its done right,

MasterPageFile="~masterurl/custom.master"

is defined:

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

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

   </Module>

July 17, 2007 2:26 PM
 

Little more than out of the box development said:

So I was asked by a partner of mine to help them create a minimal.master page for WSS. No problems, I've

July 27, 2007 4:04 AM
 

Noticias externas said:

So I was asked by a partner of mine to help them create a minimal.master page for WSS. No problems, I&#39;ve

July 27, 2007 4:15 AM
 

bci said:

I receive the same "An unexpected error has occurred".

I have gone through the steps numerous times and cannot spot what could possibly be causing this.

August 5, 2007 6:46 PM
 

Alex said:

Everything works great. What is this code for

5. Add the following line under <ListTemplates> tag:

    <ListTemplate Name=”mplib” DisplayName=”$Resources:MasterPageGallery;” Description=”$Resources:global_onet_mplib_desc;” SetupPath=”global\lists\mplib” Type=”116” BaseType=”1” Path=”GLOBAL” Hidden=”TRUE” HiddenList=”TRUE” NoCrawl=”TRUE” Unique=”TRUE” Catalog=”TRUE” OnQuickLaunch=”FALSE” SecurityBits=”11” AllowDeletion=”FALSE” AllowEveryoneViewItems=”TRUE” Image=”/_layouts/images/itdl.gif” AlwaysIncludeContent=”TRUE” DocumentTemplate=”100” />

?.  I tried to remove this and did not notice any difference.

August 7, 2007 2:36 PM
 

karthikeyan.k said:

hi,

  I tried all step's what ever you given here,

but my custom page was not creating,is giving your page cann't be display (HTTP:404).please give me the solution ..

August 13, 2007 8:19 AM
 

Rick said:

Hi,

I am just starting to work with site definitions and have a quick question, does the following need to be added to <Configuration ID="0" ,1 and 2?

10. Locate <Modules> tag after </Configurations> and add the following lines to <Modules> tag:

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

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

   </Module>

If so, would it be added this way:

     <Modules>

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

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

    </Module>

<Module Name="CustomMasterPage" />

       <Module Name="Default" />

     </Modules>

Thanks!!!

August 17, 2007 10:25 AM
 

Rick said:

I adding it in the wrong place... got it working now,

Thanks!!

August 17, 2007 11:03 AM
 

EdKrull said:

OK, is anyone else having a problem with some of the "_layouts" pages on sites created using this technique? The People and Site Settings pages work, but I cannot create anything underneath the created site...

August 21, 2007 8:48 AM
 

EdKrull said:

For some reason this step is causing the problem:

5. Add the following line under <ListTemplates> tag:

   <ListTemplate Name=”mplib” DisplayName=”$Resources:MasterPageGallery;” Description=”$Resources:global_onet_mplib_desc;” SetupPath=”global\lists\mplib” Type=”116” BaseType=”1” Path=”GLOBAL” Hidden=”TRUE” HiddenList=”TRUE” NoCrawl=”TRUE” Unique=”TRUE” Catalog=”TRUE” OnQuickLaunch=”FALSE” SecurityBits=”11” AllowDeletion=”FALSE” AllowEveryoneViewItems=”TRUE” Image=”/_layouts/images/itdl.gif” AlwaysIncludeContent=”TRUE” DocumentTemplate=”100” />

Is there any reason why removing this line would fix my problem (I get an Unknown Error on a number of the _layouts pages)?

August 21, 2007 10:12 AM
 

EdKrull said:

For some reason this step is causing the problem:

5. Add the following line under <ListTemplates> tag:

   <ListTemplate Name=”mplib” DisplayName=”$Resources:MasterPageGallery;” Description=”$Resources:global_onet_mplib_desc;” SetupPath=”global\lists\mplib” Type=”116” BaseType=”1” Path=”GLOBAL” Hidden=”TRUE” HiddenList=”TRUE” NoCrawl=”TRUE” Unique=”TRUE” Catalog=”TRUE” OnQuickLaunch=”FALSE” SecurityBits=”11” AllowDeletion=”FALSE” AllowEveryoneViewItems=”TRUE” Image=”/_layouts/images/itdl.gif” AlwaysIncludeContent=”TRUE” DocumentTemplate=”100” />

Is there any reason why removing this line would fix my problem (I get an Unknown Error on a number of the _layouts pages)?

August 21, 2007 10:12 AM
 

Anibal said:

Hi,

I have a website with one existing layout.

How can i change it?

can anyone explain me if this is enough to change the current layout, or what are the steps needed?

Thanks for any tips

August 24, 2007 8:55 AM
 

mop said:

What I am trying to figure out  how I can make one change somewhere by removing a list or web part from a main page and have it show up or go away on all sites in the site collection. Not sure if using master page would do it /site definitions or some other programmation method? any ideas?Thanks.

August 24, 2007 9:48 AM
 

Susan said:

Does anything below need to be unique if we create another template?

<ListTemplate Name=”mplib” DisplayName=”$Resources:MasterPageGallery;” Description=”$Resources:global_onet_mplib_desc;” SetupPath=”global\lists\mplib” Type=”116” BaseType=”1” Path=”GLOBAL” Hidden=”TRUE” HiddenList=”TRUE” NoCrawl=”TRUE” Unique=”TRUE” Catalog=”TRUE” OnQuickLaunch=”FALSE” SecurityBits=”11” AllowDeletion=”FALSE” AllowEveryoneViewItems=”TRUE” Image=”/_layouts/images/itdl.gif” AlwaysIncludeContent=”TRUE” DocumentTemplate=”100” />

September 5, 2007 9:05 AM
 

Francisco said:

Hey Tigirry nice post. However, when I follow this I cannot get the master page applied to any pages that I create on this site, it only gets applied on the default page. Can you help me out here?

September 21, 2007 4:50 PM
 

Hareesh said:

Hey Tigirry,

The procedure is working fine. But, whenever I make any changes to the custom masterpage, it is not working. Do we need to do anything else?

Thanks in advance

October 1, 2007 2:29 PM
 

tigirry said:

Hi Hareesh,

You do not need to do anything else. The above steps will be enough to create a new custom site definition. When you make changes to the custom masterpage, be sure not to break any rule. Good luck!

October 8, 2007 1:15 PM
 

Mirrored Blogs said:

In SharePoint 2007 there are 2 different ways to create a custom site definition - the first is to create

October 18, 2007 3:04 PM
 

beeee said:

I encountered the same error with karthikeyan.k when I used the site templete to create a new site, and try to browse the site, it give me error 404

October 19, 2007 2:47 AM
 

Owen Rumney said:

I got the same issue as EdKrull and removing the ListTemplates section fixed the problem with the _layouts.

Thanks Ed

December 4, 2007 5:19 AM
 

umang said:

hiii this works for me. but question is when i go to sitesetting and change the .css file. it automatically change the master page. because there is no custom.master there on dropdown. can you help on this appresiate it.

December 14, 2007 12:55 PM
 

dentria said:

Create a Site Definition with a Custom Master Page

January 6, 2008 11:10 PM
 

Ved said:

Hi

I  was following the steps to create a custom site definition. In Step 3 I could not find MasterPageFile="~masterurl/default.master" . Whereas I have the content as

<%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Reference VirtualPath="~TemplatePageUrl" %> <%@ Reference VirtualPath="~masterurl/custom.master" %>

Please suggest what to change?

Thanks

January 9, 2008 8:19 AM
 

Ved said:

Sorry....content could not be psoted propoerly...

Here it is again:

Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage, Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %><%@ Reference VirtualPath="~TemplatePageUrl" %><%@ Reference VirtualPath="~masterurl/custom.master" %>

January 9, 2008 8:39 AM
 

Ved said:

SORRY!!!!! My fault!!!!!!

Issue resolved. did not copy STS...

Now working fine

Thanks for this wonderful post

January 9, 2008 9:12 AM
 

novolocus.com » Creating Site Templates said:

Pingback from  novolocus.com &raquo; Creating Site Templates

January 9, 2008 9:16 AM
 

S said:

Hey i am migrating stuff onto the new Sharepoint 2007 site and i have actually migrated a list but when i want to view it it gives me this error

(1)A WebPartZone can only exist on a page which contains a SPWebPartManager. The SPWebPartManager must be placed before any WebPartZones on the page

(2) An error occurred during the processing of /sites/madseng/Lists/Wish List/AllItems.aspx. Type 'Microsoft.SharePoint.WebControls.ListProperty' does not have a public property named '__Preview'.

Any one have any idea what this is about? Sorry my tech. knowledge isnt that great so any help to sort this put would be grand.

Thankyou in advance

January 10, 2008 10:28 AM
 

Ved said:

I Created the Custom Site Template successfully.

I want to modify the master page used by the new site definition. For that  i opened the businessCustom.master in SharePoint Designer and changed according to my requirements.

When I am creating new Site with this template, I am getting error : File not found.

Can somebody help me please?

Thanks

January 16, 2008 5:42 AM
 

Susan said:

When you open up a master page that is in the 12 hive into SharePoint Designer, it updates your links, therefore killing your page. I create a site using the working template, update its master in SharePoint Designer, then copy and paste its contents in the 12 hive using NotePad.

February 5, 2008 3:50 PM
 

GuapoY said:

I was able to provision the site but,

If after provisioning the site I open site settings and under look and feel I change the master page to one from the master page gallery list drop down, and save that. Then I can't switch it back to the custom masterpage that sits in the ~catalog/masterpage of the site? any ideas?

February 16, 2008 8:01 AM
 

Gaston said:

I have a question on step 12 am I supposed to copy the webtemp.xml  rename it and drop the code in or am i supposed to create a whole new different .xml and drop the code in?

Thanks alot.

February 21, 2008 7:32 PM
 

GuapoY said:

After provisioning a site with my new site definition, I cannot go into site settings to change css file without destroying being forced to select a new master page from the site collection masterpages list. How can I overcome this problem.

Does anyone know what I'm talking about?

February 26, 2008 4:41 PM
 

Amritanshu said:

Thats really a great effort... I was just wondering how can i be able to use this under variations for creating multilingual site...

Any suggestions....

February 28, 2008 12:08 AM
 

Rigved said:

Hi Susan

I opened my global master page in sharepoint designer to make some changes and after saving the changes (just a single line in the body tag) all my sites are giving the an error: File not Found.

Any suggestions to make my sites run again....

February 28, 2008 9:22 AM
 

Susan said:

Rigved,

From my experience, SharePoint Designer updated things you did not want updated and broke your page. You're going to have to start over with a clean master page created by SharePoint.

March 5, 2008 4:11 PM
 

Gloria said:

I have a problem where we have our home page created but suddenly some users have views where 3 columns of content will be pushed to one column or columns will be overlapping or the center column will not be there.  Any ideas to the cause of this?

March 27, 2008 3:29 PM
 

AP said:

For those of you that got the (HTTP:404) Error just like I did. It's a simple fix. Just remember when you have multiple Web Front End Servers on a MOSS install, you need to make the same changes to EACH WFE in order for the changes to be complete.

So whatever you do on one, create the new folder edit the XML files etc. The same changes must be done across the board. This is just a simple copy and past of the site template folder and the newly generated XML file.

Hope this helps.

April 22, 2008 4:23 PM
 

AP said:

Tigirry,

Is there any way to have all sub sites of a site collection that uses this custom site definition template use the same master page?

So I have created a Site Collection using a custom site definition. This site definition is just a master page that has a corporate banner on it. Now, I want all subsites created to use that master page by default so that all subsites have the banner as well.

Any ideas?

April 22, 2008 4:35 PM
 

sajid said:

Failed to instantiate file "businesscustom.master" from module "CustomMasterPage": Source path "businesscustom.master" not found.

Can someone help, I followed all the steps may times I am using sharepoint server 2007 Enterprise edition.

April 23, 2008 9:43 AM
 

Janardhan said:

Tigirry !

           Iam change the Banner of my homepage using share point Designer (Edit in Default.Master)but it displayed only when administrator log in to the site..

when user login to the site it displaysshare point default banner  what is the problem ??? sub sites are displaying the banner fine for both administrator and users the Problem is only with the Home page  help me any one please

April 29, 2008 1:26 AM
 

Ravi said:

we get 404 page not found error, any suggestions?

April 29, 2008 5:57 AM
 

HS Virk said:

For Paul Dunlop,

If you still have that problem, check your logic where you apply the masterpage and debug to see if you are passing the right path to the master page.

May 19, 2008 3:13 AM
 

Shevata said:

Can we create site defination from the template?If yes then how?

May 23, 2008 6:56 AM
 

eddie said:

hi all, hope you don't mind i ask a question here.

i'm quite desperate.....

I have a single server with WSS 2.0 and Project server 2003 (but the project server has been shut-down). Now i want to upgrade to WSS 3.0 and the pre-scan found only 1 custom site. I believe those customizations are made in project server. Any quick way to just upgrade all the sites to wss 3.0 and ignore/remove/drop the customization & use the default ?

Thanks.

May 26, 2008 4:41 AM
 

@ved said:

Can this only work with copying STS i copied SPS for example and have the same issue as ved

thanks

June 3, 2008 10:32 AM
 

Thrasher said:

please anyone can help with this error, i have done all the mentioned steps to create a site collection with the custom masterpage but after i make the changes and create a new site collection using the new template i got this error "The file or folder name contains characters that are not permitted.  Please use a different name".

please anyone know what might be the problem ???

thanks in advance.

June 17, 2008 6:43 AM
 

Melissa said:

When I try to create a new site... I get the old "HTTP 404 NOT FOUND" error stating that it cannot find the webpage.  What have I done wrong?

June 18, 2008 10:18 AM
 

Mike Sharp said:

AP:  Yes, you can.  You create a feature at the web scope that assigns the master page to the web.  You create a feature event receiver, and apply your branding code to the FeatureActivated event.  Then you staple that feature to the site definition.  

Here's an edited version of the branding code...this won't run by itself (I've pulled it out of a much larger section of code), but should give you an idea of how to do it.

   protected void ApplyCustomBrand(SPWeb web, bool resetBranding)

   {

     string webUrl = "";

     webUrl = web.Url;

     string MasterUrlPath = "";

     if (web.ServerRelativeUrl != "/")

       MasterUrlPath = web.ServerRelativeUrl;

     string MasterUrl = "insert path to master URL";  

     if (MasterUrl != "")

       web.MasterUrl = MasterUrlPath + MasterUrl;

     string CustomMasterUrl = "insert path to custom master URL";

     if (CustomMasterUrl != "")  

       web.CustomMasterUrl = MasterUrlPath + CustomMasterUrl;

     // In order to flush the theme cache, we call this method twice.  

     // If there is no theme, it doesn't matter that we set it to none first

     string theme = "insert the theme name";

     web.ApplyTheme("none");

     if (theme != "")  

       web.ApplyTheme(theme);

[etc]

     web.Update();

     // If this feature was activated on an existing site collection with subwebs, we need to recursively  brand each one.

     foreach (SPWeb child in web.Webs)

     {

       ApplyCustomBrand(child, resetBranding);

       child.Dispose();

     }

   }

Don't forget to dispose of the original web object whereever it's created.  The child webs are disposed in the recursive call to this function.

Regards,

Mike Sharp

June 19, 2008 3:29 PM
 

Mike Sharp said:

Melissa:  It's probably because your default.aspx page can't find the master page.  Check the master page token to make sure it didn't get scrambled.  I've seen cases where the tilde disappears, and other such problems.  It should look like:

<%@ Page language="C#" MasterPageFile="~masterurl/custom.master"

Or if you're using a site-specific master page, it might be something like:

%@ Page language="C#" MasterPageFile="~site/_catalogs/masterpage/content.master"

Sometimes you end up with a relative URL to the master page.  This can cause 404 errors if the web isn't the root web, or if it gets moved or created somewhere else.  An example is:

<%@ Page masterpagefile="../_catalogs/masterpage/content.master"

It's better to edit this to a site-specific URL, like my previous example.

Or, possibly your CustomMasterPage module in onet.xml is not correct.  Either way, it can't find the master page, and so the 404.  Try changing it back to default.master and see if the error goes away.

Regards,

Mike Sharp

June 19, 2008 3:35 PM
 

Karthik Selvaraj said:

Thrasher:   In case you have not got rid of that error:

Any value other than "~masterurl/default.master" or "~masterurl/custom.master" in the default.aspx and defaultdws.aspx pages would result in this error. If you have specified  "xyz.master" as the custom master page in onet.xml, then "~masterurl/custom.master" will apply that to your page.

June 21, 2008 10:31 AM
 

Harry said:

I followed your instructions but with one change. Instead of using the default.master, I used an already customized masterpage that does work when implemented manually in the sharepoint interface.

After I attempt to create a site using the customized site definition, I get a 403 error in IE-"Website declined to show this webpage"

Any ideas why?

Thanks.

July 1, 2008 4:30 PM
 

ved said:

Master page created like this works fine now. But problem is if we go to any list (/sites/Lists/Listname1/AllItems.aspx ), it does not use this master page. Does that page uses some other master page may be something called Application master page???

July 21, 2008 8:29 AM
 

Jill Riesenberg said:

Why does step 5 cause an error, but when removed it works fine?  Is this code necessary and if so, what needs to be fixed to make it work?  Thanks!

July 22, 2008 1:27 PM
 

sai prasad said:

hi i am facing a real proble plz help i am having a very important deliverable which sould be submitted by the eod plz. i have opened application.master page from C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS  in share point designer and edidted from that time i am getting an error called the web site declined to open this web page in upload.aspx page plz give me the answer at the earliest.

July 28, 2008 5:03 AM
 

sai prasad said:

as soon as i change the application.master page in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS my entire site started giving errors i tried to solve some error  by placing ~/  as i cam to know that by editing the page in sd2007 breaks the links in the page . But now opening upload.aspx page it is giving me with error the website declined to view this webpage what shd i say. simply saying i edited the applcation.master page sd now i am facing error called The website declined to show this webpage when i open uplad.aspx page . plz help me

July 28, 2008 5:10 AM
 

trainssai said:

hi i am facing the same problem i made changes in application.master page C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS since then i am facing with an error The website declined to show this webpage . can any one give the solution so that i can fix this issue

July 28, 2008 8:16 AM

Leave a Comment

(required )  
(optional )
(required )