PnP Core Component - Get Default Keywords Temstore in SharePoint 2016

Please refer to the Introduction to PnP Core Component and OfficeDevPnP.Core for more details. I have created a console application and added SharePointPnPCore2016 NuGet package for the SharePoint 2016 version.
 
Code Snippet
  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 OfficeDevPnP.Core;  
  8. using OfficeDevPnP.Core.Extensions;  
  9. using Microsoft.SharePoint.Client.Taxonomy;  
  10.   
  11. namespace SP2016PnPCoreComponentDemo  
  12. {  
  13.     class Program  
  14.     {  
  15.         static void Main(string[] args)  
  16.         {  
  17.             // Input Parameters    
  18.             string siteUrl = "http://c7395723754/";  
  19.             string userName = "administrator";  
  20.             string password = "Mf165Nz2WV";  
  21.             string domain = "AD2012";  
  22.               
  23.             OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager();  
  24.   
  25.             try  
  26.             {  
  27.                 // Get the client context    
  28.                 using (var ctx = authMgr.GetNetworkCredentialAuthenticatedContext(siteUrl, userName, password, domain))  
  29.                 {  
  30.                     // Get default keywords Term Store  
  31.                     TermStore defaultKeyTermStore = ctx.Site.GetDefaultKeywordsTermStore();  
  32.                     Console.WriteLine(defaultKeyTermStore.Name);  
  33.                     Console.ReadLine();  
  34.                 }  
  35.             }  
  36.   
  37.             catch (Exception ex)  
  38.             {  
  39.                 Console.WriteLine("Error Message: " + ex.Message);  
  40.             }  
  41.         }  
  42.     }  
  43. }  
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now