SharePoint 2010 Data Type Errors

So, having being tasked with creating a good deal of Content Types recently, I thought I’d be clever and write some PowerShell Scripts to do them for me.

Everything was going well until I ran a script that had an incorrect Field Type specified. Or, more accurately I made a typo when specifying a DateTime column. The Field Type is the Column type that you get to choose when creating a new column. I didn’t spot the problem until I tried checking on the outcome via Galleries à Site Columns and saw this error: –

I traced the log message down, which provided the following information: –

“Microsoft.SharePoint.SPException: Field type Date is not installed properly. Go to the list settings page to delete this field. at Microsoft.SharePoint.SPFieldCollection.CreateSPFieldFromSafeArray(Int32 index) at Microsoft.SharePoint.SPFieldCollection.CreateSPField(Int32 ifld) at Microsoft.SharePoint.SPFieldCollection.EnsureSPField(Int32 index) at Microsoft.SharePoint.SPFieldCollection.ItemAtIndex(Int32 iIndex) at Microsoft.SharePoint.ApplicationPages.FieldListRenderer.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveIn… ”

As my errant column wasn’t yet attached to a list, I wasn’t able to log into any list settings to delete the column. My next port of call was SPD. However, upon trying this, I was hit with the following error: –

Not being able to get anywhere via the GUI, I thought I’d take a look at the Hive\14 files where SharePoint stores its Field Types. The SharePoint field times will typically be stored in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\XML\fldtypes.xml

Looking here, the definition for DateTime looked intact. For reference, the DateTime definition starts on line 346.

This meant that having made the error via scripting, I should be able to fix it via scripting. I’ll post back here if I work it out!

Advertisements