How to create a new group for the term store

Steps
  1. Open Visual Studio in your system.
  2. Select Console Applciation template and give as name.
  3. Add a Microsoft.Cleint Assembly refrence file in right side refrence tab in visual studio.
  4. Replace Program.cs with the source code. 
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. using Microsoft.SharePoint.Client;  
  7. using Microsoft.SharePoint.Client.Taxonomy;  
  8. namespace CSOMCodeSamples   
  9. {  
  10.     class Program   
  11.     {  
  12.         static void Main(string[] args)   
  13.         {  
  14.   
  15.             ClientContext clientContext = new ClientContext("http://gauti.sharepoint.com/sp/gvr");  
  16.             // Get the TaxonomySession    
  17.             TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);  
  18.             // Get the term store by name    
  19.             TermStore termStore = taxonomySession.TermStores.GetByName("GVR");  
  20.             // Create a new guid for group    
  21.             Guid guid = Guid.NewGuid();  
  22.             // Create a new group    
  23.             TermGroup termGroup = termStore.CreateGroup("NewGroup", guid);  
  24.             // Commit all the changes    
  25.             termStore.CommitAll();  
  26.             // Execute the query to the server    
  27.             clientContext.ExecuteQuery();  
  28.         }  
  29.     }  
  30. }   
Hit F5 and Check  the output...
 
Thanks for learning my blogs!!! 
Ebook Download
View all
Learn
View all