Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One or more field types are not installed properly. Go to the list settings page to delete these fields

CamlQuery query = new CamlQuery();
query.ViewXml = @"<View>"
    + "<Query>"
    + "<Where><Eq><FieldRef Name='Name' /><Value Type='Text'>"
    + fileName
    + "</Value>"
    + "</Eq>"
    + "</Where>"
    + "</Query>"
    + "</View>";
ListItemCollection item = list.GetItems(query);
clientContext.Load(item);
clientContext.ExecuteQuery();

This query gave me the error One or more field types are not installed properly. Go to the list settings page to delete these fields.

If I use <Where><Eq><FieldRef Name='Title' /><Value Type='Text'> instead of Name , it's OK.

What's wrong with it? Name is there in the list.

like image 392
kevin Avatar asked Dec 11 '12 07:12

kevin


3 Answers

If you rename a column that was defined, the internal name DOES NOT get updated. For instance, you create a custom list, it has the column 'Title' by default. If you change that column to, say, 'userId', the internal name for that column is still 'Title'.

like image 165
Brian Beech Avatar answered Sep 21 '22 12:09

Brian Beech


Not sure that this will fix that error message but this is how you can use Name:

Name (for an Out of the box document library) internal name is "BaseName".

You can use powershell to find internal names of all the columns on a list:

$web = Get-SPWeb http://yoursiteurl
$web.lists["The List Name"].Fields | FL Title, InternalName

example Query:

$query.set_innerXML("<Where><Eq><FieldRef Name='BaseName'></FieldRef><Value Type='Text'>" + $ItemName + "</Value></Eq></Where>")

Full example in powershell:

function Update-SPItem($proxy, $ItemName, $listName, $lastModified, $firstName, $lastName, $chID, $emplNumber, )
{          
   $doc = New-Object System.Xml.XmlDocument
   $viewFields = $doc.CreateElement("ViewFields")
   $viewFields.set_innerXML("<FieldRef Name='ID'></FieldRef>")
   $queryOptions = $doc.CreateElement("QueryOptions")
   $queryOptions.set_innerXML("<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><DateInUtc>FALSE</DateInUtc><ViewAttributes Scope='RecursiveAll'/>")
   $query = $doc.CreateElement("Query")
   $query.set_innerXML("<Where><Eq><FieldRef Name='BaseName'></FieldRef><Value Type='Text'>" + $ItemName + "</Value></Eq></Where>")
   $results = $proxy.GetListItems($listName, "", $query, $viewFields, "", $queryOptions, "")
   $rowXml = $results.GetElementsByTagName("z:row")
   $ItemID = $rowXml.Item(0).GetAttribute("ows_ID")

   # Update the item
   $batch = $doc.CreateElement("Batch")
   $batch.SetAttribute("OnError", "Continue")
   $batch.SetAttribute("ListVersion","1")
   $batch.SetAttribute("ViewName", "")
   $batch.InnerXml = "<Method ID='1' Cmd='Update'><Field Name='ID'>" + $ItemID + 
                     "</Field><Field Name='ImageCreateDate'>" + $lastModified + 
                     "</Field><Field Name='FirstName'>" + $firstName + 
                     "</Field><Field Name='LastName'>" + $lastName + 
                     "</Field><Field Name='CardHolderID'>" + $chID + 
                     "</Field><Field Name='EmployeeNumber'>" + $emplNumber + 
                     "</Field></Method>"

   $result = $proxy.UpdateListItems($listName, $batch)
}
like image 6
TJurgens Avatar answered Sep 19 '22 12:09

TJurgens


If you create a field through the SharePoint 2010 List Settings page, any spaces in the field name will become sequences of _x0020_ for the field's internal name. Besides spaces, SharePoint will encode other non-standard characters in a similar manner. So, you'll see the name you want on the List's web page, but programmatic access will require the internal name constructed by SharePoint (they ought to allow us to specify the internal name...)

The comment from @MarekKembrowski to the Op tells how to get the internal name using your browser.

like image 3
Zarepheth Avatar answered Sep 19 '22 12:09

Zarepheth