Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
4k views
in SharePoint Server by 1 1 2
edited by

I am getting "One or more field types are not installed properly. Go to the list settings page to delete these fields." error when using CAML query to retrieve an item by user name in javascript.

I checked the list setting, I am sure the fields data types are correct!

this is my CAML query

<Query><Where><Eq> <FieldRef Name='user name' /> <Value Type='Text'>' + user name + '</Value></Eq></Where></Query><RowLimit>10</RowLimit>

this is my code

camlQuery.set_viewXml('<Query><Where><Eq> <FieldRef Name='user name' /> <Value Type='Text'>' + user name + '</Value></Eq></Where></Query><RowLimit>10</RowLimit>');

Please help


1 Answer

1 like 0 dislike
by 159 196 380
selected by
 
Best answer

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

First of all, you should be aware of the following when you are trying to use CAML Query in JSOM

  • You must use the internal name instead of the display name in the <FieldRef> tag.
  • You should use the below format to set the name of the field as well as the value.

Ex: <FieldRef Name=\'Internal Field Name\' /> <Value Type=\'Text\'>

  • Make sure that the data type at <value> tag is the same data type of the field in the column settings. if it's a number set it as a number ... etc. (Check the supported value data types for CAML Queries at the 3rd section)

Ex: <Value Type=\'Field Data Type\'>

  • If you are using a build-in field called Name that used in the document library by default, so you should use FileLeafRef as an internal name for the build-in Name field as shown below:

Ex: <FieldRef Name=\'FileLeafRef\' />

  • .set_viewXml requires to use <view></view> tag as shown below

      camlQuery.set_viewXml('<View><Query><Where><Eq> <FieldRef Name=\'Internal Field Name\' /> <Value Type=\'Text\'>' + user + '</Value></Eq></Where></Query><RowLimit>1</RowLimit></View>');
    

If you have followed these instructions correctly, you will avoid this error "One or more field types are not installed properly. Go to the list settings page to delete these fields."

It's recommended to use the U2U tool to build your CAML query in the correct format.


Get internal name of field in SharePoint List.

  • Open List Settings.
  • Below the columns section, Click on the column name to edit it.
  • Look at the address bar, The internal SharePoint field name should be the value after Field query string as shown below:

Get SharePoint Field internal name


Supported Value Data Types list in CAML Query

You can use the following value data types for CAML Queries:

  • Boolean,
  • Text,
  • Choice,
  • Currency,
  • DateTime,
  • Guid,
  • Integer,
  • Lookup,
  • User

You might also like to read

by 1 1 2
0 0
Mohamed, you are awesome. Thank you!
If you don’t ask, the answer is always NO!
...