In Term store management "Managed_Metadata_Service", I have "My TermSet" that have terms.

enter image description here

I want to display the terms from a term store and "My TermSet" by Unique Identifier and using Javascript Object Model. How can this be done?

  • Check this and this to access the terms store using JSOM. It may help you. Jun 6, 2020 at 14:08
  • Thanks. I see them, and I tried. They are not work. I'm new to coding. Can I use these codes on a single page? And do they need some special calls to work? Jun 6, 2020 at 19:17

1 Answer 1


I am able to list terms in a term set of my default term store using following code.

var test = {};
ExecuteOrDelayUntilScriptLoaded(spready, "sp.js");
function spready() {
var scriptbase = _spPageContextInfo.webServerRelativeUrl + "_layouts/15/";
$.getScript(scriptbase + "SP.Taxonomy.js", function () {

    var termID = "8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f";
    var clientContext = SP.ClientContext.get_current();
    var taxonomySession = SP.Taxonomy.TaxonomySession.getTaxonomySession(clientContext);
    termStore = taxonomySession.getDefaultSiteCollectionTermStore();

    var termSet = termStore.getTermSet(termID);

    test.terms = termSet.get_terms();

    clientContext.executeQueryAsync(onTermSucceeded, onTermFailed);



function onTermSucceeded(sender, args) {
console.log("term success:");


function onTermFailed(sender, args) {
alert('Termset Error: ' + args.get_message());

You may also take a reference of below blog:


  • Thanks a lot. When I using your code, alert me this error message: "Termset Error: Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. "GetDefaultSiteCollectionTermStore Microsoft.SharePoint.Taxonomy.TaxonomySession.GetTaxonomySession". Where do you think the problem comes from? Aug 4, 2020 at 8:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.