I am using the code below to get terms (Later I will push these into an array). This is based on this article: Working with Taxonomy and JavaScript in SharePoint 2013

It is pushing the term names, but I also need to get the term guid and synonyms. My goal is to have a nested dropdown somewhat like the one in this SO question.

So the goals are as follows:

  1. Get all terms, synonyms, and guids pushed into an array

Here is my code for the taxonomy:

$(document).ready(function () {

function execOperation() {
    //Current Context
    var context = SP.ClientContext.get_current();
    //Current Taxonomy Session
    var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);
    //Term Stores
    var termStores = taxSession.get_termStores();
    //Name of the Term Store from which to get the Terms.
    var termStore = termStores.getByName("Taxonomy_11111111111==");
    //GUID of Term Set from which to get the Terms.
    var termSet = termStore.getTermSet("1111111-111-111-11111111");
    var terms = termSet.getAllTerms();
    context.executeQueryAsync(function () {
        var termEnumerator = terms.getEnumerator();
        var termList = "Terms: \n";
        while (termEnumerator.moveNext()) {
            var currentTerm = termEnumerator.get_current();
            termList += currentTerm.get_name() + "\n";
    }, function (sender, args) {
  • 1
    You don't need to set permissions on pages in SharePoint. They will run in the context of the user accessing the page. As long as the user can read the terms, it should work.
    – wjervis
    May 18, 2015 at 16:51
  • Could it be because I am using a "slimmed" down version of an .aspx page? I will update my post with the slimmed down page
    – Kode
    May 18, 2015 at 17:11
  • Also, how do I get the GUID and synonym values?
    – Kode
    May 18, 2015 at 17:41
  • 1
    The only thing I can find for GUID on MSDN is get_mergedTermIds(). Don't see anything for synonyms. Does your code not work? If not, what errors are you getting?
    – wjervis
    May 18, 2015 at 17:57
  • I am getting term names, but not synonyms or ids
    – Kode
    May 18, 2015 at 18:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.