I'm using this caml query in order to receive only the item with title "Full Day"

CamlQuery getFullDayHoursQuery = new CamlQuery();

                getFullDayHoursQuery.ViewXml =

                                        <FieldRef Name='Title'/>
                                        <Value Type = 'Text'>Full Day</Value>


                ListItemCollection getFullDayHoursItem = durationSettings.GetItems(getFullDayHoursQuery);

I keep getting all the items of the list returned . I tried to change it by adding 'Full Days' or "Full Days" but the Caml Query helper always return me all the results.

Any ideas?


Try with this:

var employeeList = clientContext.get_web().get_lists().getByTitle("Employees");
var camlQuery = new SP.CamlQuery();
                          "<View>" +
                              "<Query>" +
                                  "<Where>" +
                                        "<Eq>" +
                                            "<FieldRef Name=\"EmpNickName\"/>" +
                                            "<Value Type=\"Text\">" + loginName + "</Value>" +
                                        "</Eq>" +
                                  "</Where>" +
                              "</Query>" +
                               "<RowLimit>1</RowLimit>" +

var items = employeeList.getItems(camlQuery);
clientContext.load(items, "Include(ID, Title)");
  • Actually it worked when i used the LinkTitle field instead of the Title field. – shak Sep 25 '17 at 7:42
  • Please, accept the answer! – Goshky Sep 25 '17 at 8:49

Solution was to use this code :

string fullDayOption = "Full Day";

                getFullDayHoursQuery.ViewXml =

                                        <FieldRef Name='LinkTitle'/>
                                        <Value Type = 'Computed'>" + fullDayOption + @"</Value>


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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