Created
December 19, 2012 11:29
-
-
Save vman/4336064 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(){ | |
| //Current Context | |
| var context = SP.ClientContext.get_current(); | |
| //Current Taxonomy Session | |
| var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context); | |
| //Term Stores | |
| var termStores = taxSession.get_termStores(); | |
| //Term Store under which to create the Term Set. | |
| var termStore = termStores.getByName("Taxonomy_Dmxzz8tIBzk8wNVKQpJ+xA=="); | |
| //Get group by GUID | |
| var peopleGroup = termStore.getGroup("97eaa7b8-9778-4f61-acb3-7f47abba13c3"); | |
| //Create New Term Set in Group with Name, New GUID and LCID | |
| var newTermSet = peopleGroup.createTermSet("New TermSet Name","49dac247-d315-4065-8718-e8c3f50e7dcd",1033); | |
| context.load(newTermSet); | |
| context.executeQueryAsync(function(){ | |
| console.log(newTermSet.get_name()); | |
| },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