Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to use two different queries to get to different lists and use them in the same executeQueryAsync()

Something like this :

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name="IsActive"/><Value Type="Integer">1</Value></Eq></Where><OrderBy><FieldRef Name="SortOrder"/></OrderBy></View></Query>');
this.collListItem = oList.getItems(camlQuery);

var camlQuery1 = new SP.CamlQuery();
camlQuery1.set_viewXml('<View><Query><Where><Eq><FieldRef Name="IsActive"/><Value Type="Integer">1</Value></Eq></Where><OrderBy><FieldRef Name="SortOrder"/></OrderBy></View></Query>');
this.collListItem1 = oList.getItems(camlQuery);


clientContext.load(collListItem,collListItem1);
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Yes you can, but you will have to load the list item collection seperately like below and call executequery once.

clientContext.load(collListItem);
clientContext.load(collListItem1);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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