Error Importing Sites with Calculated Columns
I thought I was doing something simple – I created a site collection on a development server, built out everything the way I wanted it, then tried to export and import it into my production environment. The export went smooth with no errors but when I tried the import I got the following:
"FatalError: The formula refers to a column that does not exist."
Naturally, the error doesn’t tell me what column is causing the problem but I do have a custom site column in my site collection that creates a unique ID using a formula that derives from the ‘Created’ field, like so:
What could be wrong with that? The ‘Created’ field is a system field and the formula works just fine so what gives? I dug around in the manifest.xml file for the export and discovered that the brackets [ ] had been removed from the formula CAML; all on its own, SharePoint changed ([Created],"YYYMMDDhhmmss") to (Created,"YYYMMDDhhmmss"). I did some additional checking in some other export files and discovered that this only seems to happen for a subset of certain system fields – all my custom field names retained their brackets. I then checked the formula in the UI and lo and behold, after you enter the formula with the brackets, when you edit the field the brackets are gone. Trying to save the field again throws an error. WTF? Who was asleep at the wheel on this one???
The workaround was to set each formula field to a random string value (="Text" or something similar), re-export the site, run the import, then go back in and manually re-enter the formulas. Now that’s just silly. Somebody, somewhere wasn’t paying attention and hosed up some rather simple code. File this away under one of the many undocumented "features" that make us all love CAML so much.
As Adam Buenz would say, "Meh".
I recieve this Message every time I create a new Site or List!
That drives me crazy. Even deleting all Lists does not help.