Answered Custom site definition for Publishing site

  • Tuesday, July 01, 2008 2:26 PM
     
     

     

    Hi,

     

    I am trying to create a custom site definition based on publishing site definition. But i get following error while trying to create a site collection based on this definition.

     

    "The Office SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."

     

    below is my custom webtemp:

    Code Snippet
    <?xml version="1.0" encoding="utf-8" ?>
    <Templates xmlnsSurprisews="Microsoft SharePoint">
    <Template Name="CustomPUBLISHING" ID="10001" SetupPath="SiteTemplates\PUBLISHING">
        <Configuration ID="0" Title="CUSTOM PUBLISHING Site" Type="0" Hidden="FALSE" ImageUrl="/_layouts/1033/images/PublishingCollaborationSite.gif"
     Description="This template provides a custom publishing site."
     FilterCategories="PublishingSiteTemplate"
     DisplayCategory="Custom Site Definitions"
            VisibilityFeatureDependency="F6924D36-2FA8-4f0b-B16D-06B7250180FA">
    </Configuration>
    </Template>
    </Templates>



     


    and onet.xml

    Code Snippet

    <?xml version="1.0" encoding="utf-8" ?>
    <!-- _lcid="1033" _version="12.0.2220" _dal="1" -->
    <!-- _LocalBinding -->
    <Project Revision="3" Title="Publishing Site" ListDir="Lists" xmlns:ows="Microsoft SharePoint">
     <NavBars>
     <NavBar Name="SharePoint Top Navbar" ID="1002">
     </NavBar>
     </NavBars>
        <ListTemplates>
        </ListTemplates>
        <DocumentTemplates>

            <DocumentTemplate Path="STS" Name="" 

               DisplayName="$Resources:core,doctemp_None;" Type="100" Default="FALSE" 

               Description="$Resources:core,doctemp_None_Desc;" />

            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Word97;"

               Type="101" Default="TRUE" Description="$Resources:core,doctemp_Word97_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\word\wdtmpl.doc" TargetName="Forms/template.doc" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Excel97;" Type="103" Description="$Resources:core,doctemp_Excel97_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\xl\xltmpl.xls" TargetName="Forms/template.xls" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Powerpoint97;" Type="104" Description="$Resources:core,doctemp_Powerpoint97_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\ppt\pptmpl.pot" TargetName="Forms/template.pot" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Word;" Type="121" Default="TRUE" Description="$Resources:core,doctemp_Word_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\word\wdtmpl.dotx" TargetName="Forms/template.dotx" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Excel;" Type="122" Description="$Resources:core,doctemp_Excel_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\xl\xltmpl.xlsx" TargetName="Forms/template.xlsx" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_Powerpoint;" Type="123" Description="$Resources:core,doctemp_Powerpoint_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\ppt\pptmpl.pptx" TargetName="Forms/template.pptx" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_OneNote;" Type="111" Description="$Resources:core,doctemp_OneNote_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\onenote\template.one" TargetName="Forms/template.one" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_FP;" Type="102" Description="$Resources:core,doctemp_FP_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\fp\fptmpl.htm" TargetName="Forms/template.htm" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>
            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_BasicPage;" Type="105" Description="$Resources:core,doctemp_BasicPage_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\blankpgs\_basicpage.htm" TargetName="Forms/_basicpage.htm" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>

            <DocumentTemplate Path="STS" DisplayName="$Resources:core,doctemp_WebPartPage;" Type="106" Description="$Resources:core,doctemp_WebPartPage_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\smartpgs\_webpartpage.htm" TargetName="Forms/_webpartpage.htm" Default="TRUE"/>
                </DocumentTemplateFiles>
            </DocumentTemplate>

            <DocumentTemplate XMLForm="TRUE" Path="STS" DisplayName="$Resources:core,doctemp_BlankForm;" Type="1000" Default="TRUE" Description="$Resources:core,doctemp_BlankForm_Desc;">
                <DocumentTemplateFiles>
                    <DocumentTemplateFile Name="doctemp\xmlforms\blank\template.xml" TargetName="Forms/template.xml" Default="TRUE" />
                </DocumentTemplateFiles>
            </DocumentTemplate>            

        </DocumentTemplates>
        <BaseTypes>
        </BaseTypes>
        <Configurations>
            <Configuration ID="-1" Name="NewWeb"/>
            <Configuration ID="0" Name="Publishing">
                <Lists>
                </Lists>
                <SiteFeatures>
      <Feature ID="A392DA98-270B-4e85-9769-04C0FDE267AA">
                     <!-- PublishingPrerequisites -->
                    </Feature>
      <Feature ID="AEBC918D-B20F-4a11-A1DB-9ED84D79C87E">
                        <!-- PublishingResources -->
                        <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                            <Property Key="AllowRss" Value="false"/>
                            <Property Key="SimplePublishing" Value="false" />
                        </Properties>
                    </Feature>
                    <Feature ID="F6924D36-2FA8-4f0b-B16D-06B7250180FA">
                        <!-- Office SharePoint Server Publishing -->
                    </Feature>

                 <!-- SearchCenter Url feature -->
                    <Feature ID="7AC8CC56-D28E-41f5-AD04-D95109EB987A" >
                        <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                            <Property Key="SearchCenterUrl" Value="~SiteCollection/Search/" />
                        </Properties>
                    </Feature>

                </SiteFeatures>
                <WebFeatures>
                    <!-- Include the common WSSListTemplateFeatures used by CMS --> 
                    <Feature ID="00BFEA71-DE22-43B2-A848-C05709900100" > </Feature>
      <Feature ID="00BFEA71-E717-4E80-AA17-D0C71B360101" > </Feature>
      <Feature ID="00BFEA71-52D4-45B3-B544-B1C71B620109" > </Feature>
      <Feature ID="00BFEA71-A83E-497E-9BA0-7A5C597D0107" > </Feature>
      <Feature ID="00BFEA71-4EA5-48D4-A4AD-305CF7030140" > </Feature>

                    <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" > </Feature>

                    <Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
            <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
                   <Property Key="ChromeMasterUrl" Value=""/>
                            <Property Key="WelcomePageUrl" Value="$Resources:cmscore,List_Pages_UrlName;/default.aspx"/>
                   <Property Key="PagesListUrl" Value=""/>
                   <Property Key="AvailableWebTemplates" Value=""/>
                   <Property Key="AvailablePageLayouts" Value=""/>
                            <Property Key="SimplePublishing" Value="true" />
            </Properties>
                    </Feature>
      <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
       <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
        <Property Key="InheritGlobalNavigation" Value="true"/>
        <Property Key="ShowSiblings" Value="true"/>
        <Property Key="IncludeSubSites" Value="true"/>
       </Properties>
      </Feature>
                       
                    <Feature ID="94C94CA6-B32F-4da9-A9E3-1F3D343D7ECB">
                     <!-- Office SharePoint Server Publishing -->
      </Feature>
        
                </WebFeatures>   
                <Modules>
                    <Module Name="Home" />
                </Modules>
            </Configuration>
        </Configurations>   
        <Modules>
            <Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;" Path="">
                <File Url="default.aspx" Type="GhostableInLibrary" Level="Draft" >
                    <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />
                    <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx, ~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx" />
                    <Property Name="ContentType" Value="$Resources:cmscore,contenttype_welcomepage_name;" />
                </File>
            </Module>
        </Modules>
    </Project>

     

     

    Any Help?

Answers

  • Wednesday, July 02, 2008 1:08 PM
     
     Answered

    What you are trying to do is extremely complex and is going to involve not only custom publishing site definitions but custom features, custom web part development, and SharePoint Branding.  Hope your project has a good budget

     

    I'd probably start off by simply trying to create a publishing site def by copying how it is done out of the box.  Just create a new Publishing Portal and don't make any customizations to it.  See if you can get it to work.  This was one of the first tasks I ever completed in SharePoint and it probably took me a full two weeks to at least understand the basics.

     

    The concepts you listed are among the most advanced you could possibly pick and it is simply going to take a long time to get a handle on all of them.

     

    John

    SharePoint911: SharePoint Consulting

    http://www.rossonmoss.com

     

All Replies

  • Tuesday, July 01, 2008 3:15 PM
     
     

    If you take a look at the out of the box publishing site definition and compare it to your onet.xml it looks like you your is missing some stuff:

     

       

    Code Snippet

    <SiteFeatures>
        <!--Site Collection Features-->
        <!-- Workflow Features -->

        <!-- Workflow Expiration -->
        <Feature ID="C85E5759-F323-4EFB-B548-443D2216EFB5" />

        <!-- Workflow Review -->
        <Feature ID="02464C6A-9D07-4F30-BA04-E9035CF54392" />

        <!-- Workflow Signature -->
        <Feature ID="6C09612B-46AF-4B2F-8DFC-59185C962A29" />

        <!-- Workflow Translation -->
        <Feature ID="C6561405-EA03-40A9-A57F-F25472942A22" />

        <Feature ID="A392DA98-270B-4e85-9769-04C0FDE267AA">
         <!-- PublishingPrerequisites -->
        </Feature>
        <Feature ID="7C637B23-06C4-472d-9A9A-7C175762C5C4">
         <!-- ViewFormPagesLockDown -->
        </Feature>
        <Feature ID="AEBC918D-B20F-4a11-A1DB-9ED84D79C87E">
         <!-- PublishingResources -->
         <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
          <Property Key="AllowRss" Value="false"/>
          <Property Key="SimplePublishing" Value="false" />
         </Properties>
        </Feature>
        <Feature ID="F6924D36-2FA8-4f0b-B16D-06B7250180FA">
         <!-- Office SharePoint Server Publishing -->
        </Feature>

        <!-- SearchCenter Url feature -->
        <Feature ID="7AC8CC56-D28E-41f5-AD04-D95109EB987A" >
         <Properties xmlns="http://schemas.microsoft.com/sharepoint/">
          <Property Key="SearchCenterUrl" Value="~SiteCollection/Search/" />
         </Properties>
        </Feature>

       </SiteFeatures>

     

     

    John

    SharePoint911: SharePoint Consulting

    http://www.rossonmoss.com

     

     

     

  • Tuesday, July 01, 2008 4:21 PM
     
     
    "The Office SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated."

     

    Have you activated the The Office SharePoint Server Publishing Infrastructure feature through central administration? Or go to Site Collection Features, through Site settings and make sure it is activated. You won't be able to use the site/subsite publishing feature unless the site collection publishing feature is activated.

     

    http://sgdotnet.org/blogs/kitkai/archive/2006/11/07/Feature-GUID.aspx

     

    Here's a good site to make sure you're activating the correct features.

  • Wednesday, July 02, 2008 9:54 AM
     
     

    I have tried using all those features at site level, but no improvement.

    Also, there is no problem with "Office SharePoint Server Publishing Infrastructure" at site collection level. I tried to create this site under out-of-the-box publishing site where publishing infrastructure is already activated.

  • Wednesday, July 02, 2008 11:59 AM
     
     

    I'm confused.  What exactly are you trying to do?  Site definitions are used in creating site collections.  Can you explain the goal of what you are trying to achieve that led you to creating a custom site definition?

     

    John

    SharePoint911: SharePoint Consulting

    http://www.rossonmoss.com

     

  • Wednesday, July 02, 2008 12:55 PM
     
     

    Thanks for reply.

    When i said "I have tried using all those features at site level". It simply means i tried using "<SiteFeatures>" node as listed in your last mail. so it could activate all required feature before those listed in "<WebFeatures>".

     

    Now let me explain you my scenario. I need to have a custom publishing site definition for:

     

    ·         Being able to create a site collection with predefined sub sites.

    ·         Being able to create default pages in the root as well as sub sites.

    ·         Being able to create predefined Master page and Page Layouts.

    ·         Being able to use our Custom web parts in the template.

    ·         Being able to have predefined images, document libraries added to it.

    ·         Being able to use a default theme or have a way to change it in Site Provisioning process through object model.

    ·         Being able to associate custom workflows to it.

     

  • Wednesday, July 02, 2008 1:08 PM
     
     Answered

    What you are trying to do is extremely complex and is going to involve not only custom publishing site definitions but custom features, custom web part development, and SharePoint Branding.  Hope your project has a good budget

     

    I'd probably start off by simply trying to create a publishing site def by copying how it is done out of the box.  Just create a new Publishing Portal and don't make any customizations to it.  See if you can get it to work.  This was one of the first tasks I ever completed in SharePoint and it probably took me a full two weeks to at least understand the basics.

     

    The concepts you listed are among the most advanced you could possibly pick and it is simply going to take a long time to get a handle on all of them.

     

    John

    SharePoint911: SharePoint Consulting

    http://www.rossonmoss.com

     

  • Wednesday, July 02, 2008 2:28 PM
     
     
    Very true John. This was similar to the first task I was assigned to in SharePoint. Luckily though we had consultants to get us started. Still took months for me to figure out.

     

  • Sunday, July 06, 2008 1:56 AM
     
     

    Looks like your missing the BaseSiteStapling Feature, you may not be activating the features in the correct order, and you may not have all of the prerequisites as mention by John.....

     

    The F6924D36-2FA8-4f0b-B16D-06B7250180FA  Feature ID refers  to the PublishingSite feature and Feature ID  97A2485F-EF4B-401f-9167-FA4FE177C6F6 Feature ID refers  to the BaseSiteStapling feature. You have the Publishing Site Feature ID in your WebTemp.xml but NOT the BaseStaplingFeature (Very Important)  

     

    97A2485F-EF4B-401f-9167-FA4FE177C6F6 - BaseSiteStapling

    This is the BaseSiteStapling feature, it will staple several features to site definitions listed in the feature, it contains dozens of FeatureSiteTemplateAssociation nodes, it is interesting to note that:

    Feature B21B090C-C796-4b0f-AC0F-7EF1659C20AE (BaseSite) is  stapled  to the following site templates :

    STS#0 , STS#2 , MPS#0 , MPS#1 , MPS#2 , MPS#3 , MPS#4 , WIKI#0 , BLOG#0 , BDR#0 , EAWF#0 , OFFILE#0 , OFFILE#1 , PWA#0 , PWS#0 , SPS#0 , SPSMSITE#0 , SPSTOC#0 , SPSTOPIC#0 , SPSNEWS#0 , SPSNHOME#0 , SPSSITES#0 , SPSBWEB#0 , SPSCOMMU#0 , SPSREPORTCENTER#0 , SPSPORTAL#0 , SRCHCEN#0 , PROFILES#0 , CMSPUBLISHING#0

     

    The BaseSite Feature is an ActivationDependency feature and activates the following Features - THIS IS KEY <ActivationDependency FeatureId="E978B1A6-8DE7-49d0-8600-09A250354E14" /> LocalSiteDirectorySettingsLink Feature  <ActivationDependency FeatureId="14AAFD3A-FCB9-4bb7-9AD7-D8E36B663BBD" /> LocalSiteDirectoryControl Feature  <ActivationDependency FeatureId="5F3B0127-2F1D-4cfd-8DD2-85AD1FB00BFC" /> PortalLayouts Feature  <ActivationDependency FeatureId="2ED1C45E-A73B-4779-AE81-1524E4DE467A" /> WebPartAdderGroups Feature 

    Feature 99FE402E-89A0-45aa-9163-85342E865DC8 (BaseWeb) is stapled to the following site templates : STS#0 , STS#2 , MPS#0 , MPS#1 , MPS#2 , MPS#3 , MPS#4 , WIKI#0 , BLOG#0 , BDR#0 , EAWF#0 , OFFILE#0 , OFFILE#1 , PWA#0 , PWS#0 , SPS#0 , SPSMSITE#0 , SPSTOC#0 , SPSTOPIC#0 , SPSNEWS#0 , SPSNHOME#0 , SPSSITES#0 , SPSBWEB#0 , SPSCOMMU#0 , SPSREPORTCENTER#0" , SPSPORTAL#0 , SRCHCEN#0 , PROFILES#0 , CMSPUBLISHING#0

    The BaseWeb Feature is also an ActivationDependency feature and activates the following Features: <ActivationDependency FeatureId="E8734BB6-BE8E-48A1-B036-5A40FF0B8A81" /> RelatedLinksScopeSettingsLink Feature <ActivationDependency FeatureId="56DD7FE7-A155-4283-B5E6-6147560601EE" /> AnalyticsLinks Feature  <ActivationDependency FeatureId="0BE49FE9-9BC9-409d-ABF9-702753BD878D" /> FeatureStapling Feature 

    It sounds like what you are trying to do is ctreate a Portal Site Definition  there are a couple of pretty good blogs. I have included a link to Pauls below but also check out Todd Baginski on Custom Site Definitions he start with using the STS Definition its really the easiest to start with...

     

    Portal Site Definitions
    http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx 
    Creating a set of sites and SubSites for multiple teams by creating each site one at a time can be a bit of a drag and a definite administrative drain.  What would be nice is to be able to specify a set of sites in a predefined heirarchy that the can be used as a single reusable template.  This set of sites is what SharePoint 2007 calls a "portal" (The most overused word in the SharePoint world).  SharePoint 2007 gives you the ability to create a portal site definition by using the PortalProvisioningProvider contained in the Microsoft.SharePoint.Publishing assembly.  This class parses an XML file and builds the site hierarchy defined in the file. 

     

    Hope this helps....

    -Ivan

     

    http://dimension-si.com/blog

    http://linkedin.com/in/iasanders

     

     

  • Friday, October 01, 2010 11:50 AM
     
     Proposed Answer

    Hi, you need to activate some required site features through onet.xml and your work will be done. Check this blog post: http://www.katriendg.com/aboutdotnet/2007-5-1-publishing-web-syntax-onet-xml.aspx

    Its very helpful. I was going through the same problems and this post solved my issue.

    • Proposed As Answer by Mike1428 Tuesday, December 14, 2010 10:06 AM
    •  
  • Wednesday, December 15, 2010 7:29 PM
     
     

    I am having a lot of issues on something very similar.  I have a feature that adds pages to pages so pages/error.aspx, pages/......

    My onet file sets up the site and it breaks if the feature I just mentioned is in there.  It says it is trying to add error.aspx because the list pages does not exist.  If I take this feature out, create my site, then activate the feature it works.  It seems like the issue is that the feature tries to execute before the publishing is finished provisioning the /pages directory.  It seems like things are firing in the wrong order, even though this feature is the last thing in my onet file.

    I added a feature dependency to the feature in question for the publishing feature and now I get an error "Provisioning did not succeed. Details: The site template was not provisioned successfully. Delete this site collection in Central Administration, and then create a new site collection. OriginalException: Operation is not valid due to the current state of the object. " so this tells me that the dependency works, but I just can't get around how the publishing feature seems to activate last.

     

     

     

  • Wednesday, December 15, 2010 8:40 PM
     
     

    This must be the SharePoint Gods cruel joke. I have currently been assigned a project similar this (and its one of my first major ones). I am pulling my hair out trying to wrap my head round this (Building a custom site definition - for publishing sites). and all the other fun stuff already mentioned here. With a ridiculous timeline of 3 weeks (lol).

     

    Has this gotten easier in SP2010? Does anyone have any advice as to the best way to Create a site definition for publishing sites?