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

7

17
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.

Calista answered 11/12, 2012 at 7:13 Comment(9)
in SPQuery you have to use Internal Names of fields. Please verify that field called what's the internal name of your Name field.Tweedy
@MarekKembrowski - > What's internal Names ? Sorry I'm quite new to SharePoint.Calista
Long story short - SharePoint fields have two kinds of names - Display Name and Internal Name. In some places (like SPListItem[string fieldName]) Display Names have to be used, in some (like SPQuery) Internal Names have to be used. Easiest way to check, what's the Internal Name of your field, is to go to field definition on SharePoint site and check Query string in url. For example: http://localhost/_layouts/FldEdit.aspx?List={F8645DD3-CE80-4ECF-849F-6F851EECA2A7}&Field=LocalNumber my Local Number field has internal name LocalNumber.Tweedy
So when we are uploading, we have to provide the internal name too? Or is it automatically created by SharePoint ? Thanks for your answer !!Calista
What do you mean by 'Uploding'? When you're creating new field (column) most of the time SharePoint is creating Internal Names automatically. In some scenarios, you can force to use Internal Name of your choose (when your creating field from xml), but most of the time, you don't have control over it.Tweedy
I mean when we are saving file in SharePoint. So which way would be the best way to query a particular document from a list ? The above way doesn't work well for me. Thanks for your answers !!!Calista
Why can't I go to the field definition of the Name ? I can go all other columns.Calista
@MarekKembrowski -> Thanks a lot. It's working now after I do some research about the internal names.Calista
In German, the error message reads "Mindestens ein Feld ist nicht richtig installiert. Wechseln Sie zur Listeneinstellungsseite, um diese Felder zu löschen.". In case anyone is googling this.Changsha
A
19

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'.

Astrophysics answered 28/1, 2013 at 19:23 Comment(0)
D
7

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)
}
Decurved answered 11/6, 2013 at 19:50 Comment(0)
R
3

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.

Rappee answered 11/10, 2016 at 16:20 Comment(0)
H
2

The same error message is displayed for a badly constructed queries such as ones that do not have topmost tags around sibling elements.

They query:

<Where><Contains><FieldRef Name='...' /><Value Type='Text'>Foobar</Value></Contains></Where><OrderBy><FieldRef Name='Modified' /></OrderBy>

would give this same error message, but not:

<View><Where><Contains><FieldRef Name='...' /><Value Type='Text'>Foobar</Value></Contains></Where><OrderBy><FieldRef Name='Modified' /></OrderBy></View>
Hua answered 22/7, 2016 at 13:38 Comment(0)
E
1

I assume the problem that you have is not the <FieldRef Name='Name' /> but the <Value Type='Text'>. If you check the type of Name Field you will find it is a File. If anyone knows how to query that I would also be thankfull. For now I am using Title.

Everglades answered 10/5, 2013 at 12:40 Comment(1)
We have to use Internal Name. Then we will be OK. For Name, it's <FieldRef Name='FileLeafRef' />. Good luck !!!Calista
H
1

I struggled with this for too long, and the answer was right in front of me. For me, the comment that Marek Kembrowski posted to the original question, was exactly what I needed to do, but I glazed over it because it was a comment, so I'm going to reiterate what Marek said in my own words so that hopefully the next person that comes along with this issue won't miss the comment posted above.

In sharepoint, when you create a column, there are two text fields where you give information to describe the field, Column Name and Description.

enter image description here

What KILLED me, was that the sharepoint site was set up with the Column name [OrderID] and a different description [CON].

Here you can see what Sharepoint looks like with the OrderID created first and the OrderID I created after I figured out the problem . . . The difference is one of the OrderID column names says OrderID ;)

enter image description here

The ONLY way I can see the original column name, is to Hover over the column in the Library Settings as Marek mentioned above . . . this will show the link at the bottom of the browser. If you click to edit it . . . it's not even right . . . doesn't even show anything about the real column name . . .even shows the description name in the column name field . . . GGRRRRRRR!!!!!

Anyhow, Here is the code I used to retrieve the data:

        // Starting with ClientContext, the constructor requires a URL to the 
        // server running SharePoint. 
        ClientContext context = new ClientContext(siteUrl);

        // The SharePoint web at the URL.
        Web web = context.Web;

        List docList = context.Web.Lists.GetByTitle("OrderDocuments");

        CamlQuery query2 = new CamlQuery();

        //This query will NOT work . . .CON is not a column in the sharepoint repository
        //query2.ViewXml = "<View><Query><Where><Eq><FieldRef Name='CON' /><Value Type='Number'>4</Value></Eq></Where></Query></View>";

        //This query WILL WORK.  The actual Column name is OrderID in Sharepoint
        query2.ViewXml = "<View><Query><Where><Eq><FieldRef Name='OrderID' /><Value Type='Number'>4</Value></Eq></Where></Query></View>";
        ListItemCollection collListItem = docList.GetItems(query2);

        context.Load(collListItem);
        context.ExecuteQuery();

+1 to Marek for the correct solution above. I wish I'd seen it the first time I found this page.

Huonghupeh answered 18/7, 2017 at 15:3 Comment(0)
H
1

Another good way to check for internal name without scripting is to go to the list settings and click on the column you want to check. You can see its internal name as a query string Field like bellow. Check internal name

Hemispheroid answered 6/4, 2021 at 4:44 Comment(1)
This solved my issue with updating row.Ethelethelbert

© 2022 - 2024 — McMap. All rights reserved.