Just wondering whats the best way to get the name of the Global Term store without hard coding it?

I have this at the moment

var termStoreName = "Taxonomy_xxxxxxxxxxxxxxxxx";
const store: ITermStore = await taxonomy.termStores.getByName(termStoreName);

You can get it as below in SP Online:

1) Add the below import statement:

import { taxonomy, ITermStoreData} from "@pnp/sp-taxonomy";

2) After that you can get the name of the termstore as below:

taxonomy.termStores.get().then((d: ITermStoreData[]) => {      
  if(d.length > 0){
    var termStoreName = d[0].Name;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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