jeudi 5 mars 2015

How to get termstore GUID by giving its name



I've a term-set called My Term Set, I need to get the Unique Identifier by passing its name. How can i do that? This is the code i have tried so far but it gives undefined Please help me thanks a lot


Both terms.Guid, terms.id gives undefined



var termSetName = "My Term Set";
var locale = 1033;

var clientContext = SP.ClientContext.get_current();
var taxonomySession = SP.Taxonomy.TaxonomySession.getTaxonomySession(clientContext);
var termStore = taxonomySession.getDefaultSiteCollectionTermStore();
var termSets = termStore.getTermSetsByName(termSetName, locale);
var termSet = termSets.getByName(termSetName);
var terms = termSet.getAllTerms();

alert(terms.Guid);
alert(terms.id);







0 commentaires:

Enregistrer un commentaire