Created
December 19, 2012 11:16
-
-
Save vman/4336010 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 group. | |
| var termStore = termStores.getByName("Taxonomy_Dmxzz8tIBzk8wNVKQpJ+xA=="); | |
| //New Group with name and new GUID | |
| var newGroup = termStore.createGroup("New Group Name","b300304a-1693-4629-a1c0-dff7bda644ff"); | |
| context.load(newGroup); | |
| context.executeQueryAsync(function(){ | |
| console.log(newGroup.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