Hi,
I've tried to do something like get 3 list items from 3 lists. I can see that the items do get retrieved in the callback but when I try to access them, it complains saying the item is not loaded yet or needs to be explicitly retrieved and then the item suddenly becomes unloaded (ie all the properties I saw are now suddenly gone). Am I missing something? My sample code is below:-
var ctx = new SP.ClientContext(siteUrl); var lists = ctx.get_web().get_lists(); this.ListItem1 = lists.getByTitle("List1").getItemById(1); this.ListItem2 = lists.getByTitle("List2").getItemById(2); this.ListItem3 = lists.getByTitle("List3").getItemById(3); ctx.load(this.ListItem1); ctx.load(this.ListItem2); ctx.load(this.ListItem3); ctx.executeQueryAsync(onItemRetrievalSucceeded, onItemRetrievalFailed); function onItemRetrievalSucceeded(sender,args) { /* alert(this.ListItem1.get_item("Title")) */ // this fails saying the item is not ready?? } function onItemRetrievalFailed(sender,args) { /* handle error */ }
Any help would be much appreciated.
Kind Regards
Chris