4

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);
7

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);
0

This is also valid

var allWebs = spCtx.LoadQuery(spCtx.Web.Webs.Include(SharePointWeb.WebInclusions));
var allLists = spCtx.LoadQuery(spCtx.Web.Lists.Include(SharePointList.ListInclusions));
spCtx.ExecuteQuery();

where WebInclusions and ListInclusions are lambda expressions that nominate the fields you want to load.

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.