3

Have I written the below CAML query correctly? Am I missing anything? I am encountering an error on below line of code.

SPQuery spQuery = new SPQuery();
spQuery.Query = "<Where><And><Eq><FieldRef Name='Flag'/><Value Type='Text'>" + "1" + "</Value></Eq>" + "<Eq><FieldRef Name='Connection Type'/><Value Type='Text'>" + "Active Directory" + "</Value></Eq></And></Where>";

The error reads...

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

"

1
  • 3
    Please check the internal names of the columns. Please check internal name of connection type. Sometimes space between column names occurs this type of issues. Also check their column types. Oct 1, 2016 at 18:57

2 Answers 2

3

The name of the columns with spaces have the space represented in Unicode as _x0020_, try the following line:

spQuery.Query = "<Where><And><Eq><FieldRef Name='Flag'/><Value Type='Text'>" + "1" + "</Value></Eq>" + "<Eq><FieldRef Name='Connection_x002_Type'/><Value Type='Text'>" + "Active Directory" + "</Value></Eq></And></Where>";

In order to get the internal name of a column:

  1. Go into List Settings or the site columns list in site settings.
  2. Click on the column you want the internal name for.
  3. Look at the URL for Field=<Column Name>

It should be at the end of the URL and will give you the exact internal name for your column.

1
  • take a look at robocaml.codeplex.com.
    – iOnline247
    Oct 4, 2016 at 20:58
2

The <FieldRef Name='Connection Type'> is incorrect. If you used a space when creating this column then the internal name is Connection_x0020_Type

1
  • Thanks All. Yes the mistake was in the Field Name. The correct field name is "Connection_x0020_Type"
    – Zakir HC
    Oct 3, 2016 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.