1

the problem is a CAML query of SPQuery that throw an error: One or more field types are not installed properly any help please: it work perfect in U2U CAML source code is:

   sb.Append("<Where>");
    sb.Append("<Or>");
                            sb.Append("<And>");
                                sb.Append("<Eq><FieldRef Name='" +   
  ConstVariables.valide_les_destinataires_encodé + "' /><Value    
  Type='Boolean'>0</Value></Eq>");
                                sb.Append("<Eq><FieldRef Name='" + 
  ConstVariables.envoyer_vers_directeur_encodé + "' /><Value 
  Type='Boolean'>1</Value></Eq>");
                            sb.Append("</And>");

                            sb.Append("<Or>");
                                sb.Append("<And>");
                                    sb.Append("<And>");
                                        sb.Append("<Eq><FieldRef Name='" + 
  ConstVariables.valide_les_destinataires_encodé + "' /><Value 
  Type='Boolean'>1</Value></Eq>");
                                        sb.Append("<Eq><FieldRef Name='" + 
   ConstVariables.envoyer_vers_directeur_encodé + "' /><Value 
  Type='Boolean'>1</Value></Eq>");
                                    sb.Append("</And>");
                                    sb.Append("<And>"); 
                                        sb.Append("<Eq><FieldRef Name='" + 
  ConstVariables.reponse_destinataires_encodé + "' /><Value Type='Boolean'>1</Value>
  </Eq>");
                                        sb.Append("<Eq><FieldRef Name='" + 
   ConstVariables.fiche_distribution_prepare_encodé + "' /><Value 
  Type='Boolean'>1</Value>
  </Eq>");
                                    sb.Append("</And>");
                                sb.Append("</And>");
                                sb.Append("<Eq><FieldRef Name='" + 
  ConstVariables.valid_par_directeur_ca_encodé + "' /><Value 
  Type='Boolean'>0</Value></Eq>");
                             sb.Append("</Or>");
                        sb.Append("</Or>");

                        sb.Append("</Where>");



   SPView vv = list.Views["Tous les documents"];
            SPQuery squery = new SPQuery();
            squery.Query = sb.ToString();

            vv.Query = squery.Query;
            vv.Update();

            list.Update();
            list.ParentWeb.Update();

   //the CAML query above is equivalent to this after i intercept it in debugging:

 <Where>
<Or>
    <And>
        <Eq><FieldRef Name='Valid_x00e9__x0020_les_x0020_destinataires'   
   /><Value Type='Boolean'>0</Value></Eq>
        <Eq><FieldRef Name='Envoyer_x0020_vers_x0020_Directeur' /><Value 
  Type='Boolean'>1</Value></Eq>
    </And>
    <Or>
        <And>
          <And>
               <Eq><FieldRef 
  Name='Valid_x00e9__x0020_les_x0020_destinataires' /><Value 
  Type='Boolean'>1</Value></Eq>
               <Eq><FieldRef Name='Envoyer_x0020_vers_x0020_Directeur' 
 /><Value Type='Boolean'>1</Value></Eq>
          </And>
          <And>
               <Eq><FieldRef Name='R_x00e9_ponse_x0020_Destinataire' 
   /><Value Type='Boolean'>1</Value></Eq>
               <Eq><FieldRef 
  Name='Fiche_x0020_distribution_x0020_pr_x00e9_par_x00e9_e' /><Value 
  Type='Boolean'>1</Value></Eq>
          </And>
        </And>
        <Eq><FieldRef Name='Valid_x00e9__x0020_par_x0020_directeur' />
   <Value Type='Boolean'>0</Value></Eq>
    </Or>
</Or>



  </Where>
4
  • I can see you have defined constants for all your fields. Please match the field name constant values with the field names in caml query builder.
    – Unnie
    Commented Jun 11, 2014 at 12:23
  • yeah absolutely i did and the generated query below does work perfect in U2U CAML
    – ezzaam
    Commented Jun 11, 2014 at 12:26
  • so try to only read these constants in your code, do they exists outsite your caml query builder?
    – Gwny
    Commented Jun 11, 2014 at 12:37
  • May be a silly question, but are you 100% sure that you run your query against the correct list and not another list accidentally? Commented Jun 12, 2014 at 15:04

1 Answer 1

1

Check that your CAML list query is not referencing inexistent fields in the primary content type and in the list itself. Remove the fields or recreate them again.

Your Answer

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

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