MOSS Content Deployment Jobs - Lookup Fields and requirements
Content Deployment Job is a nice feature of MOSS 2007 to secure your main site from unauthorized and accidental changes and have approved content being deployed via standard MOSS functionality.
But Content Deployment Jobs are a bit tricky :(
There are some areas which I'd like to highlight in the current post, which helps you to save hours in configuring Content Deployments Path and Jobs
Requirements
To have successful contend deployment you need to prepare your sites correctly. There is a great post from Stefan Gossner who provided detailed explanations to all pre-requirement.
Just to summarize, you need:
-
Destination Site without any template pages (don't use "Blank" template even)
-
Deploy features to Source and Destination sites
-
Activate features ONLY on Destination site
Incremental Deployment
When you set deployment path and created your first job you need to do full deployment ("Deploy all content" option) first, and after it's done set the incremental deployment.
Your incremental job could fail with the next exception
"Violation of PRIMARY KEY constraint 'PK__#ExportObjects____50430BFC'. Cannot insert duplicate key in object 'dbo.#ExportObjects'."
The reason is that SP1 for MOSS changed the document versioning system, but no changes where done to Content Deployment Job functionality. To solve this issue you may need to install the following hotfix http://support.microsoft.com/kb/950279 or disable minor versioning for specific lists (google to find details about this)
Lookup fields
The biggest trick in Content Deployment Jobs relates to Lookup fields deployed via Feature. I think that the following exception will be familiar for those who tried run Content Deployment Jobs for Site with Lookup Fields feature
The element 'FieldTemplate' in namespace 'urn:deployment-manifest-schema' has invalid child element 'Field' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'Field' in namespace 'urn:deployment-manifest-schema'. at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(ValidationEventHandler eventHandler, Object sender, XmlSchemaValidationException e, XmlSeverityType severity) at System.Xml.Schema.XmlSchemaValidator.ElementValidationError(XmlQualifiedName name, ValidationState context, ValidationEventHandler eventHandler, Object sender, String sourceUri, Int32 lineNo, Int32 linePos, Boolean getParticles) at System.Xml.Schema.XmlSchemaValidator.ValidateElementContext(XmlQualifiedName elementName, Boolean& invalidElementInContext) at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String localName, String namespaceUri, XmlSchemaInfo schemaInfo, String xsiType, String xsiNil, String xsiSchemaLocation, String xsiNoNamespaceSchemaLocation) at System.Xml.XsdValidatingReader.ProcessElementEvent() at System.Xml.XsdValidatingReader.ProcessReaderEvent() at System.Xml.XsdValidatingReader.Read() at Microsoft.SharePoint.Deployment.XmlFormatter.ParseObject(Type objectType, Boolean isChildObject) at Microsoft.SharePoint.Deployment.XmlFormatter.DeserializeObject(Type objectType, Boolean isChildObject, DeploymentObject envelope) at Microsoft.SharePoint.Deployment.XmlFormatter.Deserialize(Stream serializationStream) at Microsoft.SharePoint.Deployment.ObjectSerializer.Deserialize(Stream serializationStream) at Microsoft.SharePoint.Deployment.ImportObjectManager.ProcessObject(XmlReader xmlReader) at Microsoft.SharePoint.Deployment.SPImport.DeserializeObjects() at Microsoft.SharePoint.Deployment.SPImport.Run()
5/22/2008 11:14 AM Content deployment job 'Remote import job for job with sourceID = 0ffd575d-df2f-474f-83b6-f3454f2e7d0d' failed.The exception thrown was 'System.Xml.Schema.XmlSchemaValidationException' : 'The element 'FieldTemplate' in namespace 'urn:deployment-manifest-schema' has invalid child element 'Field' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'Field' in namespace 'urn:deployment-manifest-schema'.'
The problems is exactly in deployment scripts of Lookup fields. There are several samples how to deploy lookup fields via feature (http://www.sharepointnutsandbolts.com/2007/04/feature-to-create-lookup-fields-on.html) but all of them are not suitable for the Content Deployment Jobs. Because you will get the exception which I posted above.
The only way to find out why this happens is to use 3rd party tools (SharepointSpy or FieldsExplorer) to compare the SchemaXML of Lookup Fields after deployment via FeatureReceiver. So, after scrutinizing this issue I found out that deploying Lookup Fields via FeatureReceiver differs from Lookup fields create via Central Admin Web site. FeatureReceiver deployment adds additional attribute "xmlns="http://schemas.microsoft.com/sharepoint/" to the Lookup SchemaXML which breaks the Content Deployment Job.
So, the solution is simple - verify the published schema in FeatureReceiver before calling Update() method for Lookup Field and remove this attribute.
Mirror: MOSS Content Deployment Jobs - Lookup Fields and requirements