I am trying to get a collection of terms under a term set so I can see which have custom properties. I have been searching for almost a week now and keep coming up with nothing. I found several example pieces of code as to how to retrieve them but every time I try to run
var context = SP.ClientContext.get_current();
//Current Taxonomy Session
var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);
//Term Stores
var termStores = taxSession.get_termStores();
context.load(taxSession);
context.load(termStores);
context.executeQueryAsync(function () {
var storeEnum = termStores.getEnumerator();
}, function (sender, args) {
console.log(args.get_message());
});
It bombs on the getEnumerator with the error Uncaught Error: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
I have loaded SP.Taxonomy.js, Sp.Runtime.js directly in my custom masterpage.
0 commentaires:
Enregistrer un commentaire