0

I want to retrieve set of list items based on selected IDs. Is there a way to retrieve in single shot by passing array of IDs? using unmanaged CSOM/JSOM/REST API.

1

Something like this:

var context = SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('List Title');
var itemIds = [1, 2, 56, 90, 108 ];
var items = [];  
itemIds.forEach(function(itemId){
    var item = list.getItemById(itemId);
    context.load(item);
    items.push(item);
});
context.executeQueryAsync(
  function() {
     items.forEach(function(item){
        console.log(item.get_item('Title')); 
     });
  },
  function(sender,args){
     console.log(args.get_message());
  }
); 

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.