One or more field types are not installed properly
Today I got this error
Microsoft.SharePoint.SPException: One or more field types are not installed properly. Go to the list settings page to delete these fields. —> System.Runtime.InteropServices.COMException: One or more field types are not installed properly. Go to the list settings page to delete these fields.0x81020014 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) — End of inner exception stack trace — at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() at Microsoft.SharePoint.SPListItemCollection.get_Count() at MyCorp.SharePoint.Branding.LinksControl.Page_Load(Object sender, EventArgs e)
I was running the following code within a User Control
SPQuery query = new SPQuery();
query.Query = “<Where><Eq><FieldRef Name=’LinkSection’ /><Value Type=’Text’>” + “Top Navigation” + “</Value></Eq></Where>”;
query.ViewFields = “<FieldRef Name=’LinksUrl’ /><FieldRef Name=’Title’ />”;
SPListItemCollection items = list.GetItems(query);
if (items.Count > 0 )
{
}
The items.Count was generating the above error. Aha, something wrong with the list?! Wrong!!
The Solution
Something wrong with the query.
Name=’LinkSection’
My custom field was called LinksSection. So a simple typo and yet another half an hour gone as the error was pointing me in the wrong direction.