Is there a method to get term URL in taxonomy in SharePoint TermStore using PnPJS library?

I am using this code to retreive term Name, Parent and ID:

export interface IPTerm {
parent?: string;
id: string;
name: string;
url: string;

export interface ITaxonomyPopulatorState {
  terms: IPTerm[];

public async getTermsetWithChildren(): Promise<IPTerm[]> {
    let tms: IPTerm[] = [];
    return new Promise<any[]>((resolve, reject) => {
      const tbatch = taxonomy.createBatch();
      return taxonomy.termStores.getByName("Taxonomy_InjkMqAvKdUBok59vNz/Mg==").get().then((resp1: ITermStore) => {
        return resp1.getTermGroupById("7bdebaed-a684-4682-a5a6-6c1f1e976641").termSets.get().then((resp2: ITermSet[]) => {
          resp2.forEach((ele: ITermSet) => {
            ele.terms.select('Name', 'Id', 'Url').inBatch(tbatch).get().then((resp3: ITerm[]) => {
              resp3.forEach((t: ITerm) => {
                let ip1 = {
                  parent: ele['Name'],
                  name: t['Name'],
                  id: t['Id'].replace("/Guid(", "").replace(")/", ""),

          tbatch.execute().then(_r => {


Iterm interface:

export interface ITerm extends IClientSvcQueryable {
    readonly labels: ILabels;
    readonly parent: ITerm;
    readonly pinSourceTermSet: ITermSet;
    readonly reusedTerms: ITerms;
    readonly sourceTerm: ITerm;
    readonly terms: ITerms;
    readonly termSet: ITermSet;
    readonly termSets: ITermSets;
    createLabel(name: string, lcid: number, isDefault?: boolean): Promise<ILabelData & ILabel>;
    deprecate(doDeprecate: boolean): Promise<void>;
    get(): Promise<(ITermData & ITerm)>;
    addTerm(name: string, lcid: number, isAvailableForTagging?: boolean, id?: string): Promise<ITerm & ITermData>;
    getDescription(lcid: number): Promise<string>;
    setDescription(description: string, lcid: number): Promise<void>;
    setLocalCustomProperty(name: string, value: string): Promise<void>;
    update(properties: {
        Name: string;
    }): Promise<ITermData & ITerm>;

Check Term.LocalCustomProperties._Sys_Nav_TargetUrl

My debug screenshot:

enter image description here


The interface defined in pnpsp.

import { taxonomy, ITermStore, ITermSet, ITerms, ITermData, ITerm } from "@pnp/sp-taxonomy";
| improve this answer | |
  • Can you please show me your Iterm interface. I will update the post to show mine. – bAbdenour Dec 31 '19 at 11:36
  • Check my update. – Lee_MSFT Jan 2 at 1:16
  • I can retrieve Simple link from _Sys_Nav_SimpleLinkUrl, but _Sys_Nav_TargetUrl returns nothing ; why? I would like to use Friendy URL – bAbdenour Jan 5 at 12:24
  • Check term.LocalCustomProperties._Sys_Nav_FriendlyUrlSegment – Lee_MSFT Jan 6 at 2:39
  • I tried that, but it does not work :/ Is there any other manipulation to do in the term store management ? – bAbdenour Jan 6 at 3:34

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.