Created
December 18, 2012 12:52
-
-
Save vman/4327698 to your computer and use it in GitHub Desktop.
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
| $(document).ready(function(){ | |
| var scriptbase = _spPageContextInfo.webServerRelativeUrl + "_layouts/15/"; | |
| $.getScript(scriptbase + "SP.Runtime.js", | |
| function () { | |
| $.getScript(scriptbase + "SP.js", function(){ | |
| $.getScript(scriptbase + "SP.Taxonomy.js", execOperation); | |
| }); | |
| } | |
| ); | |
| }); | |
| function execOperation(){ | |
| var context = SP.ClientContext.get_current(); | |
| var list = context.get_web().get_lists().getByTitle('TaxonomyCustomList'); | |
| var listItem = list.getItemById(1); | |
| context.load(listItem); | |
| context.executeQueryAsync(function(){ | |
| //Multivalue Taxonomy Column | |
| var taxEnumerator = listItem.get_item("MyTaxColumn").getEnumerator(); | |
| while(taxEnumerator.moveNext()){ | |
| //Label | |
| var currentTerm = taxEnumerator.get_current(); | |
| //Label | |
| var label = currentTerm.get_label(); | |
| //Term GUID | |
| var termGUID = currentTerm.get_termGuid(); | |
| //Type ID | |
| var typeID = currentTerm.get_typeId(); | |
| //WSS ID | |
| var wssID = currentTerm.get_wssId(); | |
| } | |
| },function(sender,args){ | |
| console.log(args.get_message()); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment