Skip to content

Instantly share code, notes, and snippets.

@vgrem
Created January 19, 2014 10:31
Show Gist options
  • Save vgrem/8503006 to your computer and use it in GitHub Desktop.
Save vgrem/8503006 to your computer and use it in GitHub Desktop.
Load discussion items from Discussions List
function getDiscussions(listTitle,OnItemsLoaded,OnError)
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle(listTitle);
context.load(list);
var qry = SP.CamlQuery.createAllFoldersQuery();
var discussionItems = list.getItems(qry);
context.load(discussionItems);
context.executeQueryAsync(
function() {
OnItemsLoaded(discussionItems);
},
OnError
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment