how to get this CAML query to work

I have a javascript and i can’t get the CAML or listitems.

//http://vadimtabakman.com/nintex-forms-multilingual-form.aspx  NWF$  (document).ready(function () {     var language = NWF$  ('#' + varLanguage);      language.change(function() {     //alert(language).val(); // else alert error message      var languageValue = this.value.split(";#")[1];     alert(languageValue);      var clientContext = SP.ClientContext.get_current();         var oList = clientContext.get_web().get_lists().getByTitle('Survey Label Translation');      var camlQuery = new SP.CamlQuery();     alert('line 15');     camlQuery.set_viewXml(         '<View>' +             '<Query>' +                 '<Where>' +                      '<Eq>' +                         '<FieldRef Name=\'Language\'/><Value Type=\'Choice\'>' + Spanish + '</Value>' +                     '</Eq>' +                 '</Where>' +             '</Query>' +         '</View>'         );       alert('line 26');     this.collListItems = oList.getItems(camlQuery);     clientContext.load(collListItems);       alert('line 30');     alert(collListItems.status);     if (collListItems.status == 200)      {        var rows = collListItems.responseXML.getElementsByTagName('z:row');         for(x=0; x < rows.length; x++)        {          var listLabelID = rows[x].getAttribute('ows_Title'); // query field + ows prefix          var listTranslation = rows[x].getAttribute('ows_Translation'); // query field + ows prefix          translations[listLabelID] = listTranslation;          var node = NWF$  ('.' + listLabelID).find('.nf-label-control');          node.text(listTranslation);        }      }      else      {        alert('There was an error: ' + collListItems.statusText); // else alert error message      }       }); }); 

CAML – How to handle filter

SP 2010. I have a value “East & West” and list name Region. How do I handle special characters?

here is the caml that breaks

  <ViewFields>     <FieldRef Name='ActionStatus' />   </ViewFields>   <Where>     <Contains>       <FieldRef Name='Region' />       <Value Type='Choice'>East & West</Value>     </Contains>   </Where> 

SPService GetListItems with CAML : can’t get the example to work with status giving error

I am new to SPServices and trying start with example GetListItems. Below is my code

$  (document).ready(function() {      GetTasks(); });  function GetTasks() {      var method = "GetListItems";     var list = "Tasks";     var fieldsToRead ="<ViewFields><FieldRef Name='Title'/></ViewFields>";     var query ="<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>1</Value></Eq></Where></Query>";             $  ().SPServices({             operation: method,             async: false,               listName: list,             CAMLViewFields: fieldsToRead,                completefunc: function (xData, Status) {                      debugger;                     $  (xData.responseXML).find("z\:row").each(function() {                          alert("hello");                         var name = ($  (this).attr("ows_Title"));                     });                                 }     }); } 

The debugger in the completefunc is hit but when I check the status of function(xData, status) the status returns “error”.And after this alert("hello") does not hit.

What is that I am doing wrong in this ?

CAML queries suddenly quit working; SP Online; SPServices

I have CAML queries performed against SharePoint Online lists through SPServices that have worked beautifully for 5 years. Sometime in the last couple of weeks they started returning incorrect results. The problems all seem to be oriented around the “EndOfLife” text field which always contains a “1” or a “0” (without the quotes).

<Where>   <Eq>     <FieldRef Name='EndOfLife'></FieldRef>     <Value Type='Text'>1</Value>   </Eq> </Where> 

Executed through SPServices in the browser, this query against a particular list returns 10 results. The same query against the same list executed through U2U CAML Query Builder returns over 900 results.

Executed against a different list in another site collection, that query returns 3 results through SPServices in the browser and 2000 results through U2U CAML Query Builder.

There are no changes on my end that correlate with the timing of these problems.

Any idea why these queries executed through SPServices in the browser would suddenly be returning incorrect results?

Add filter and pagination to CAML query

I’m developing a visual web part for Sharepoint 2010.

I would display all documents from a specific DL, but this DL contains more than 7000 items.

So I would like to add a pagination (show only 20 results per page) and display, above the list of files, some textbox and dropdown to filter the right content from the CAML query.

Which way do you suggest to do these two things?

CAML Query all lists with same name under a site collection

We are using SP2016 on-premise. We have a site collection with over 50 subsites under it. All the subsites are created with same Site template. Therefore all of them have a list called “ContactInfo“.(https://sharepoint.com/sites/ABC/project1/Lists/ContactInfo) All the ContactInfo have same fields but they do not have specific content type.

I need to create a report using Report builder 2016 and SSRS (native mode) to list all the contact information across all the subsites. Could you advise is it possible achieved by CAML? If so could you provide some reference? Thanks.

‘n’ number of CAML queries in a single executeQueryAsync function

How to execute ‘n’ number of CAML queries to get a different list of objects? We can use multiple clientContext.load() if we have a defined number of queries like clientContext.load(collListItem); clientContext.load(collListItem1);

In my scenario, the queries are generated and cannot determine the number of CAML queries needs to be executed. Is this possible?

clientContext.load(collListItem1); clientContext.load(collListItem2); ... ... clientContext.load(collListItemN); 

CAML Query not Working Correctly

I want to return the events in an Event Calendar for the current week for a web page. I would prefer the current week Friday through Sunday, but that seemed too complicated.
When I use this code it returns events starting approximately 1 week from now and it’s showing some events two months from now. I’ve tried using Week instead of the offset days and that didn’t return anything. Would be happy just to get today + next seven days events. Any insight into this would be greatly appreciated. Please see query:

function getMyListData()     {                                  var method = "GetListItems";                              var webURL =  $  ().SPServices.SPGetCurrentSite() ;                                  var list = "Events Calendar";                                   var fieldsToRead = "<ViewFields>"+"<FieldRef Name='Name' />" +"</ViewFields>";             var query = "<Query><Where><Geq><FieldRef Name='EventDate' /><Value IncludeTimeValue='TRUE' Type='DateTime'><Today OffsetDays='7' /></Value></Geq></Where><OrderBy><FieldRef Name='EventDate' Ascending='True' /> </OrderBy></Query>";                        

CAML Query ID of Last List Item Where Status = New

I have a SharePoint 2013 custom list and a requirement to load the last list item where Status = New. I first tried SPGetLastItemID with a CAML query filter – however, that method only returns items for the current user, and I need the last item where Status = New for ALL items/users.

For some reason I can’t seem to get this working (no alert box):

var LastID; function QueryLastNewStatusItem() {     var clientContext = new SP.ClientContext();     var List = clientContext.get_web().get_lists().getByTitle('Tracker');     var query = new SP.CamlQuery();     var textCaml ="         <View>          <RowLimit>1</RowLimit>          <Query>              <OrderBy>              <FieldRef Name='ID' Ascending='False' />              </OrderBy>             <Where>             <Eq>                 <FieldRef Name='Status' />                 <Value Type='Text'>New</Value>             </Eq>         </Where>          </Query>         </View>";     query.set_viewXml(textCaml);     var item = List.getItems(query);     context.load(item);     LastID = GetItemID(item);     alert(LastID); }    

I am beginner level with JavaScript and pretty new to CAML queries. I did use internal names for FieldRef Names within the query and made sure that the function is firing.