Created
September 20, 2016 11:50
-
-
Save theuntitled/5ec4a9e98757d6588e3075ee796dc593 to your computer and use it in GitHub Desktop.
SharePoint 2013 JSOM Taxonomy Managed Metadata Field Result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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