I'm trying to use this fairly straightforward code:

function getAllTerms() {
    var context = new SP.ClientContext.get_current();
    SP.SOD.executeFunc("SP.Taxonomy.js", 'SP.ClientContext', function () {

        //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_Pu0HiX4GZKMCNnSDgo8P3g==");
        //GUID of Term Set from which to get the Terms.
        var termSet = termStore.getTermSet("99197470-943b-43d1-8375-209fb75251f6");
        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) {

But whether I try to use getByName or getDefaultSiteCollectionTermStore, I always get the error:

Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. "GetTermSet

I know there's a possible configuration change in Central Administration to carry out with SharePoint 2013, but this is SharePoint Online, so surely this should just work?

1 Answer 1


Login to the portal using SharePoint admin credentials.

After that, go to the below url:


It will open the term store in the admin site.

Now go to the term set in the term store.

Ensure that available for tagging check box is checked as below. After that save the termset.

enter image description here

It should work now.

If the error still persists, try the below refactored code:

var termSetId = "99197470-943b-43d1-8375-209fb75251f6"; 

var context = SP.ClientContext.get_current();
var taxonomySession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);
var termStore = taxonomySession.getDefaultSiteCollectionTermStore();
var termSet = termStore.getTermSet(termSetId);
var terms = termSet.getAllTerms();
  • Ha. I already had "Available for tagging" enabled, but I was using the guid of the parent group instead of the term set itself, and your screenshot pointed me towards that. Thank you! Jun 15, 2017 at 10:03

Your Answer

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

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