SharePoint 2007 Publsihing Site Stops Recognizing Custom Landing Page

Greetings!  It’s been a while since I’ve posted anything, but I’m hoping this may prove helpful to someone somewhere sometime.

Recently myself and a few other SharePoint team members at my site rolled a number of new and updated features into production.  This was a long and grueling affair, and part of the reason was we spent a few hours on this issue I’m about to describe.  We never found anyone describe this problem (or solution) through googling, so I’m either it’s hard to find, or nobody has talked about it.

We have a custom landing page layout and landing page layout content type that we use on a collaboration site.  A previous version was in production and worked fine.  Part of our big production rollout the other day was to update both the landing page layout and content type.  We deployed these two features in our usual way: by updating the 12-hive, de-activating, install -force’ing, and [re]activating the features through stsadm on the command line.  The landing page content type activated fine, the landing page page layout activated fine, but we have a 3rd feature which is for the landing page itself (to dynamically create it through some code in FeatureActivated), and it was throwing an index-out-of-bounds exception when we tried to activate it.

Looking at the exception, and the FeatureActivated code, we narrowed it down to what appeared to this block of code:

SPContentTypeId contentTypeId = new SPContentTypeId(welcomePageLayoutContentTypeId);
PageLayout[] layouts = pubWeb.GetAvailablePageLayouts(contentTypeId);
PageLayout welcomePageLayout = layouts[0];
page = pubWeb.GetPublishingPages().Add(dcsLandingPageFileName, welcomePageLayout);

Specifically, to the layouts[0].  This seemed to indicate that GetAvailablePageLayouts was not returning our custom landing page layout associated with our custom landing page content type.

We spent some time re-deploying all 3 features again with no success at that last step.  We made sure that the content type looked up to date, that the Master Pages and Page Layouts gallery had the most recent version of the page layout, that the page layout was correctly associated with the landing page content type, that we had deleted the old landing page from the Pages library, etc., etc.   Nothing we tried helped.

Eventually through some googling, another member of my team found this installable feature that lets you do a number of things, among them to enumerate all the available page layouts to the command line.  The feature is described here

Once we had installed and ran that feature, we discovered that our custom landing page layout was not showing up in the list.  We re-verified the the site settings that the page layout was in the gallery and was associated to the page layout content type, and that the content type was installed correctly, etc., but nothing seemed to help.

Then we finally had a break-through:  looking at the enumerated available page layouts listing from the stsadm tool, we noticed that not only was our custom page layout not showing, but a number of other page layouts were missing, all of which were out of the box SharePoint Publishing content types!  We determined this by comparing the enmerated page layouts list on our “broken” site vs. the list on another site using the same lading page that was functioning correctly.

This lead us to the Site Collection Features and Site Features pages to verify that publishing was enabled.  It was.  We were further stumped.  On a whim, we decided to try de-activating both features and re-activating them.  Guess what–this solved our problem!

So even though publishing appeared to be enabled, somehow, bizarrely, it was actually broken.  Flipping the switch on and off resolved this, after a few hours of face-palming and much stress.  I hope this tale may help you if you ever run into this.  It’s worth a shot!


0 Responses to “SharePoint 2007 Publsihing Site Stops Recognizing Custom Landing Page”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Scott’s recent tweets…


%d bloggers like this: