2016-01-07 51 views

回答

0

就像Martin Vseticka寫道的那樣,你得到的實際JSON會有所幫助。這裏有一個半複雜的例子,我與合作:

http://i.stack.imgur.com/WyPjT.png

我遵循的是找出任何層級的最低水平位,然後組裝逐一父母下,直到你得到的策略根。

TS接口來形容它(少數意見)是這樣的:

module RL.SS.Portal.RLToday.Interfaces { 
 

 
    // Don't blame us for this craziness. This is the zoo that MMS ASMX service unleashes when it succeeds. 
 
    /* 
 
     data 
 
      TermStore 
 
       T: [] of 
 
        DS: string or object, --> this is where the description would go if there is one. blank string if no desciption, otherwise object -> 
 
         TD: object -> 
 
          a11: string (the description; you can see and edit this description in the UI) 
 
        LS: object -> 
 
         TL: object -> **NOTE: this will be an array if there are multiple labels. 
 
          a31: boolean (seems to be if it's the default value when there are multiple labels) 
 
          a32: string (seems to be the value of the term as a string) 
 
        TMS: object -> 
 
         TM: object -> 
 
          a12: "Locations" (prob term set name) 
 
          a17: boolean (seems to indicate whether end users can use this for tagging. visible in the term set UI via site collection admin) 
 
          a24: string (guid, parent ID if any) 
 
          a40: string, blank in the sample I have 
 
          a45: string (guid, not sure what) 
 
          a67: string, blank in my sample 
 
        a9: guid of the term 
 
        a21: boolean, true if there are children 
 
        a61: "0" in my sample 
 

 
     This is very hard to model since they vary on whether something is an array or not based on the alternative keywords. 
 

 
     This definition assumes for now that there are not variable keywords. 
 

 
     None of the GUIDs have parenthesis in the raw result. 
 
    */ 
 
    export interface MmsAsmxTL { 
 
     _a31: boolean, // Indicates if it's the default term label (mainly useful if there are multiple labels for this term) 
 
     _a32: string // Value of the term 
 
    } 
 

 
    export interface MmsAsmxLS { 
 
     TL: MmsAsmxTL 
 
    } 
 

 
    export interface MmsAsmxTM { 
 
     _a12: string, // name of the term set 
 
     _a17: boolean, // whether it's available for tagging or not 
 
     _a24: string, // some kind of guid, 
 
     _a40: string, // Not sure, 
 
     _a45: string, // guid, not sure for what, 
 
     _a67: string // another blank string as per the sample data 
 
    } 
 

 
    export interface MmsAsmxTMS { 
 
     TM: MmsAsmxTM; 
 
    } 
 

 
    export interface MmsAsmxTD { 
 
     _a11: string; // Description of the term. Not mandatory. 
 
    } 
 

 
    export interface MmsAsmxDS { 
 
     TD ?: MmsAsmxTD // optional, will not exist if there's not description 
 
    } 
 

 
    export interface MmsAsmxT { 
 
     DS: MmsAsmxDS, 
 
     LS: MmsAsmxLS, 
 
     TMS: MmsAsmxTMS, 
 
     _a9: string, // guid of the term 
 
     _a21: boolean, // whether there are children 
 
     _a61: string 
 
    } 
 

 
    export interface MmsAsmxTermStore { 
 
     T: MmsAsmxT[] 
 
    } 
 

 
    export interface MmsAsmxData { 
 
     TermStore: MmsAsmxTermStore; 
 
    } 
 
    export interface MmsAsmxSuccessResult { 
 
     data: MmsAsmxData; 
 
    } 
 
}

HTH。