Export-SPWeb fails with "These columns don't currently have unique values"
During a content database migration from SharePoint 2010 to 2013, we also had a requirement to move a few sites (SPWeb) to new locations. The plan was to first mount the Content Database on the SharePoint 2013 farm, create an evaluation upgrade site collection and then export the content from the upgraded site using "Export-SPWeb". This operation failed, and after several retries it seems like this is not supported.
PowerShell command to export site:
[code language="PowerShell"]
Export-SPWeb http://sps:8080/ -Path "C:\Backup\sps-8080.bak"
[/code]
This error was found in the log file:
[code language="html"]
[13.01.2014 10:26:58] FatalError: These columns don't currently have unique values.
[13.01.2014 10:26:58] Debug: at System.Data.ConstraintCollection.AddUniqueConstraint(UniqueConstraint constraint)
at System.Data.ConstraintCollection.Add(Constraint constraint, Boolean addUniqueWhenAddingForeign)
at System.Data.ConstraintCollection.Add(Constraint constraint, Boolean addUniqueWhenAddingForeign)
at System.Data.DataRelationCollection.DataSetRelationCollection.AddCore(DataRelation relation)
at System.Data.DataRelationCollection.Add(DataRelation relation)
at System.Data.DataRelationCollection.Add(String name, DataColumn parentColumn, DataColumn childColumn)
at Microsoft.SharePoint.Deployment.ListObjectHelper.GetNextBatch()
at Microsoft.SharePoint.Deployment.ObjectHelper.RetrieveDataFromDatabase(ExportObject exportObject)
at Microsoft.SharePoint.Deployment.ListObjectHelper.RetrieveData(ExportObject exportObject)
at Microsoft.SharePoint.Deployment.ExportObjectManager.GetObjectData(ExportObject exportObject)
at Microsoft.SharePoint.Deployment.ExportObjectManager.MoveNext()
at Microsoft.SharePoint.Deployment.ExportObjectManager.ExportObjectEnumerator.MoveNext()
at Microsoft.SharePoint.Deployment.SPExport.SerializeObjects()
at Microsoft.SharePoint.Deployment.SPExport.Run()
[13.01.2014 10:26:58] Progress: Export did not complete.
[/code]
Solution
This problem seems to occur once you have created an evaluation site within the same content database. Deleting the evaluation site does not fix the problem unfortunately.
- Restore site collection from backup to a new content database
- Export data with Export-SPWeb from the site, but avoid using an evaluation site.
It is possible to run Export-SPWeb both when the site collection is in 2010-mode and naturally after upgrading it to 2013 as long you stay away from creating an evaluation site.
Summary
If you plan to reorganize the content in the same operation as a content database migration from SharePoint 2010 to 2013, avoid using an evaluation site as it leaves your entire site collection in a state where content cannot be exported. With this experience I now always take a extra site collection backup before using creating evaluation sites (which itself is a excellent feature).