Code Snippet
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.SharePoint.Client;
- using OfficeDevPnP.Core;
- using OfficeDevPnP.Core.Extensions;
- using Microsoft.SharePoint.Client.Taxonomy;
-
- namespace SP2016PnPCoreComponentDemo
- {
- class Program
- {
- static void Main(string[] args)
- {
-
- string siteUrl = "http://c7395723754/";
- string userName = "administrator";
- string password = "Mf165Nz2WV";
- string domain = "AD2012";
- Guid termSetID = new Guid("e6b07ab0-99d2-42b7-b2c7-ab6cdadf216d");
- string termName = "PnP Create Group";
-
- OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager();
-
- try
- {
-
- using (var ctx = authMgr.GetNetworkCredentialAuthenticatedContext(siteUrl, userName, password, domain))
- {
-
- Term term = ctx.Site.GetTermByName(termSetID, termName);
- Console.WriteLine(term.Description);
- Console.ReadLine();
- }
- }
-
- catch (Exception ex)
- {
- Console.WriteLine("Error Message: " + ex.Message);
- }
- }
- }
- }