Skip to content

Instantly share code, notes, and snippets.

@theuntitled
Created September 20, 2016 11:50
Show Gist options
  • Select an option

  • Save theuntitled/5ec4a9e98757d6588e3075ee796dc593 to your computer and use it in GitHub Desktop.

Select an option

Save theuntitled/5ec4a9e98757d6588e3075ee796dc593 to your computer and use it in GitHub Desktop.
SharePoint 2013 JSOM Taxonomy Managed Metadata Field Result
class TaxonomySearchResult {
id: string;
label: string;
termSetId: string;
parentTermId: string;
constructor(resultValue: string) {
const informationParts = resultValue.split(";");
for (let i = 0; i < informationParts.length; i++) {
const informationPart = informationParts[i];
const parts = informationPart.split("|");
if (parts.length === 0) {
continue;
}
if (parts[0] === "GP0") {
this.id = parts[1].replace("#", "");
}
if (parts[0] === "GTSet") {
this.termSetId = parts[1].replace("#", "");
}
if (parts[0] === "GPP") {
this.parentTermId = parts[1].replace("#", "");
}
if (parts[0] === "L0" && parts.length === 3) {
this.label = parts[2];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment