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. ClientContext clientContext = new ClientContext("http://gauti.sharepoint.com/sp/gvr");
  15. // Get the TaxonomySession
  16. TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
  17. // Get the term store by name
  18. TermStore termStore = taxonomySession.TermStores.GetByName("GVR");
  19. // Create a new guid for group
  20. Guid guid = Guid.NewGuid();
  21. // Create a new group
  22. TermGroup termGroup = termStore.CreateGroup("NewGroup", guid);
  23. // Commit all the changes
  24. termStore.CommitAll();
  25. // Execute the query to the server
  26. clientContext.ExecuteQuery();
  27. }
  28. }
  29. }
Hit F5 and Check the output...
Thanks for learning my blogs!!!