Tuesday, March 31, 2009

Custom publishing site definition and MCMS 2002 migration to SharePoint 2007

Last week I developed a custom minimal publishing site definition based on the Andrew
Connell’s one
. All the tests went just fine. After that we wanted to use it for the
conversion of our portal from MCMS 2002 to SharePoint 2007. We created a site collection
based on this custom site definition as the destination of the conversion and launched
the operation. Few minutes later the content migration failed with the following
error :

MCMS 2002 migration to SharePoint 2007 Exception

Migration throws exception: An item with the same key has already been added.

At System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean
add) at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) at Microsoft.SharePoint.SPFeaturePropertyCollection.Add(SPFeatureProperty
property) at Microsoft.SharePoint.Publishing.Administration.ContentMigration.<>c__DisplayClass4.b__3()
at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.RunWithWebCulture(SPWeb
web, CodeToRun webCultureDependentCode) at Microsoft.SharePoint.Publishing.Administration.ContentMigration.ConvertToComplexPublishing(SPWeb

After hours of debugging and thanks to Reflector, we found out that the content migration method “ConvertToComplexPublishing” was looking for a property called “SimplePublishing” and expecting the value “false” for it. In my Onet.xml the property value was set to “true”.

FYI, if the “SimplePublishing” property is set to “false”, that means that the approval workflow is required for every publishing page. We changed our custom publishing site definition to have this property set to “false” :

< Property key="SimplePublishing" value="false"/>

After this, the content migration went just as we have expected.