문제

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;
    console.log(termStoreName);
  }      
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top