Question

I have a site definition, and in this site definition I would like to provision some pages with the webparts when the site is created using this template.

I cannot provision whole the pages library because then you get an error when activating the publishing feature.

How do I do it exactly? So that the pages which I provide are in the library pages and the feature is activated correctly.

I've tried to provision the page with the module in feature but at the end there is nothing in the pages and I cannot find the page anywhere ...

    <Module Name="Pages" Url="$Resources:cmscore,List_Pages_UrlName;">
        <File Name="Page1.aspx" Url="Page1.aspx" Type="GhostableInLibrary" Path="Page1.aspx" IgnoreIfAlreadyExists="True"> ....
</File></Module>
Was it helpful?

Solution

According to this blog post moving your Module to a SPWeb feature and have it be activated after the publishing feature in your onet.xml should solve your problem.

SharePoint provisions in the following order:

  1. global onet.xml

  2. SPSite scoped features defined in onet.xml, in the order they are defined in the file.

  3. SPSite scoped stapled features, in quasi random order

  4. SPWeb scoped features defined in onet.xml, in the order they are defined in the file.

  5. SPWeb scoped stapled features, in quasi random order

  6. List instances defined in onet.xml

  7. Modules defined in onet.xml

Implications:

  1. SPSite features should never depend on anything provisoned by an SPWeb feature. Since generally spweb scoped features are always provisioned after SPSite scoped features, the SPSite scoped feature can't rely on a resource that gets provisioned in an SPWeb scoped feature.

  2. Features can't depend on lists or files provisioned in onet.xml. Features are provisioned before the actual lists and files which are contained in onet.xml. However, list instances and files defined in onet.xml can take dependencies on list definitions or list instances defined in features.

  3. List instances and modules defined in onet.xml or within web scoped features listed in the tag of onet.xml should never take any dependencies on features that are "stapled". Stapled features are transient and may not be stapled if the admin adjusts their configuration.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top