0

I'm trying to do a camlquery with 3 and where but i get back an exception: Values doesn't fall within expected range

I've tried to place the and tag everywhere but still doesn't work

List<string> columns = new List<string>();

                foreach (SP.Field fieldTemp in fieldColl)
                {
                    //logger.WriteInfo(fieldTemp.InternalName.ToString()); 
                    columns.Add("<FieldRef Name='" + fieldTemp.InternalName.ToString() + "' />");
                }
                //construit la query
                SP.ListItemCollection resultat = null;
                SP.CamlQuery query = new SP.CamlQuery();
                query.ViewXml = "<View Scope='RecursiveAll'>" +
                                "<Query>" +
                                "<Where>" +
                                    "<And>" +
                                        "<Eq>" +
                                            "<FieldRef Name='Ann_x00e9_e' />" +
                                            "<Value Type='Text'>" + year + "</Value>" +
                                        "</Eq>" +
                                            "<And>" +
                                            "<Eq>" +
                                                "<fieldref name='N_x00B0__x0020_circulaire' />" +
                                                "<value type='Text'>" + numCiruclaire + "</value>" +
                                            "</Eq>" +
                                            "<Eq>" +
                                                "<FieldRef Name='Doc_x0020_Language' />" +
                                                "<Value Type='Text'>" + lang + "</Value>" +
                                            "</Eq>" +
                                           "</And>" +
                                    "</And>" +
                                "</Where>" +
                                "</Query>" +
                                "<ViewFields>" +
                                //"<FieldRef Name='Modified' />"+ //i try this alors but still not work
                                    string.Join("", columns.ToArray()) +
                                "</ViewFields>" +
                                "</View>";
                resultat = list.GetItems(query);
                clientContext.Load(resultat);
                clientContext.ExecuteQuery();

if i do a query with where on this only field, i get the exception too

'N_x00B0__x0020_circulaire'

I checked the internalname of the fields in the list and it's correct

user1898765
  • 323
  • 1
  • 6
  • 18

1 Answers1

0

the issue came from the second equal 'fileref' was in lowercase and not in CamlCase

user1898765
  • 323
  • 1
  • 6
  • 18