I have some code that returns all of the lists in my site however I need to only get lists that are using the discussion board template and I have hit a stumbling block with this.
I currently have the following:
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', PreSaveAction);
function PreSaveAction() {
context = SP.ClientContext.get_current();
web = context.get_web();
lists = web.get_lists();
context.load(lists);
context.executeQueryAsync(Succeeded, Failed);
function Succeeded() {
var listItemEnumerator;
listItemEnumerator = lists.getEnumerator();
while (listItemEnumerator.moveNext()) {
oListItem = listItemEnumerator.get_current();
var listname = oListItem.get_title();
}
}
function Failed(sender, args) {
console.log("Failed" + args.get_message() + '\n' + args.get_stackTrace());
}
}
I have tried a few different approaches but so far had no luck, I know that the list template ID is 108 and I have tried to use this to return the list I need but unfortunately I have not had any luck.