I'm using SharePoint 2013 and want to use CSOM/CAMLquery to retrieve some related information in another list. The related list may have 500+ items in it and I want to return information about maybe 20 of them. The only information I have about the 20 items is their ListItemID which is stored as the "look up key" in the related list.
I've found all kinds of tutorials for looking up the items one at a time.
var ItemContext = new SP.ClientContext(<siteURL>); var relatedList = ItemContext.get_web().get_lists().getByTitle(<listname>); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml("<View>" + "<Query>" + "<Where><Eq>" + "<FieldRef Name=\'RelatedItemID\'/>" + "<Value Type=\'Number\'>"+ListItemID+"</Value>" + "</Eq></Where>" + "</Query>" + "</View>"); var collListItem = relatedList.getItems(camlQuery); ItemContext.load(relatedList); ItemContext.load(collListItem, 'Include(ID,OtherProperties....)'); ItemContext.executeQueryAsync(.....
And that seems to work well. But I have to make a call for each of the 50 items.
Is there a way I can query for all 50 items at once? I'm not having much luck search for that. Most tutorials show how to filter on some common value in the part, but not how to query on 50 different values.