All I do below is with Visual Studio 2010. I cannot use Sharepoint Designer because I don't have the right to do it.
I have a Content Type, which is the associated content type of a page layout. They are deployed with Feature without problem. The page layout has some publishing page instances.
I now add a column to the Content type, and deployed the project. Now on my site collection the field is added in Column list and the Content Type is updated. I want to add the new field to the page layout. I edited the page layout by adding the corresponding SharePointWebControls
. But when I try to add new page or edit the existing pages using the layout, the newly added column won't show.
I've done lots of search, and quite a lot of people have encountered the same problem. I followed the article here: http://www.sharepointnutsandbolts.com/2010/06/feature-upgrade-part-1-fundamentals.html. A great article indeed, but not regretfully covering page layout updating subject. I tried adding the following code the sample in the article:
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Version="1.0.0.0">
<UpgradeActions>
<VersionRange BeginVersion="0.0.0.0" EndVersion="0.9.9.9">
<AddContentTypeField ContentTypeId="0x010100C568DB52D9D0A14D9B2FDCC96666"
FieldId="{a816136e-ad2c-47d0-cb5a-023d2afb5be1}" PushDown="TRUE"/>
</VersionRange>
</UpgradeActions>
</Feature>
But it doesn't work.
And here in this article: http://madalina.blog.com/2012/01/updating-sharepoint-page-layouts-the-right-way/ it describes in this situation we should reset the page layout to its site definition. But I would prefer doing it all programatically with Visual Studio.
I wonder if I could change something in the Feature EventReceiver, like override the FeatureUpgrading
Method? Or it simply goes with some configuration in the .xml file? Or I still have to do additional coding...
Or maybe, should I do it again from the start with the Object Model? I just discovered the method, I don't know a lot about it yet. (And here is a comparison between feature based XML and Object Model: Feature based XML vs. Object Model: Which is better for content type development?)
Please help me, thanks!