views:

1150

answers:

1

I have a custom page-library which a custom content-type and a page-layout all inside a site-definition.

Works as expected. The only thing I cannot get around is that if I upgrade the solution with the page-lib, ctype, page-layout via stsadm everything is updated except the page-layout.

New fields in the ctype --> no problem Changed views in the page-lib --> no problem

Updated PageLayout --> ERROR

The page-layout section:

<!-- specific page-layout to display LKW data -->
    <File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
      <Property Name="Title" Value="$Resources:CustomLayouts,Title;" />
      <Property Name="MasterPageDescription"
                Value="$Resources:cmscore,PageLayout_BlankWebPartPage_Description;" />
      <Property Name="ContentType"
                Value="$Resources:cmscore,contenttype_pagelayout_name;" />
      <Property Name="PublishingPreviewImage"
                Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png" />
      <Property Name="PublishingAssociatedContentType"
                Value=";#$Resources:FieldsCTypes,cTypeDisplayName;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900D38AAFB8072F441984BC947D49503947;#" />
    </File>

The relevant section in the onet.xml:

<Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;Custom" Path="">
      <File Url="Default.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
        <Property Name="Title"
                  Value="$Resources:Layouts,DisplayName;" />
        <Property Name="ContentType"
                  Value="$Resources:cmscore,contenttype_welcomepage_name;"/>
        <Property Name="PublishingPageLayout"
                  Value="~SiteCollection/_catalogs/masterpage/CustomPage.aspx, $Resources:PalfingerPlatformsOrderRoot,LKWpageDefaultTitle;" />
        <Property Name="PublishingPageContent"
                  Value="" />
      </File>
    </Module>

The strange thing is, if I just have a page-layout with no underlying page-library I can update the page-ayout. The problem only occurs if I use a custom page-layout inside a custom page-library.

I did some Google search and found a hint - the problem could be that the page-layout is unghosted. I checked this with a small sample code:

SPFile file = folder.Files["Default.aspx"];
 if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
 {
   file.RevertContentStream();
 }

After executing the code the Page-Layout is upgraded and uses the new page-layout.

The Problem is that this is no real solution for me because I have approx. 1000 site-collections using the site-def. and the page-layout. Updating all of them is quite painful. Does anybody know a solution for this?

+1  A: 

I would like to comment on one thing. Looks like IgnoreIfAlreadyExists="TRUE" is not working properly refer to this link, may be reverting the value to FALSE should help.

<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
Kusek
Nope - unfortunatelly the flag does not help in my case. After a solution upgrade or uninstall/install solution the page-layouts are still not updated.
Henrik
Lot's of sources saying IgnoreIfAlreadyExists does not work as expected and the "only" solution is to use some custom code - so my feature receiver solution from above looks like to be a kind of solution after all.
Henrik