using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Taxonomy;
namespace TaxonomyCodeSamples
{
class Program
{
static void Main(string[] args)
{
// ClienContext - Get the context for the SharePoint Site
// SharePoint site URL - http://c4968397007/
ClientContext clientContext = new ClientContext("http://c4968397007/");
// Get the TaxonomySession
TaxonomySession taxonomySession =
TaxonomySession.GetTaxonomySession(clientContext);
// Get the term store by name
TermStore termStore =
taxonomySession.TermStores.GetByName("MMS");
// Get the taxonomy group by name
TermGroup termGroup =
termStore.Groups.GetByName("Group");
// Get the termset by name
TermSet termSet =
termGroup.TermSets.GetByName("Termset");
// Set the sort order for the terms
termSet.CustomSortOrder = "85e1983a-1ff7-4c46-9004-b64c4a74aa05:b2faeeb7-f9ab-47e9-b525-23cc1b98e394";
termStore.CommitAll();
clientContext.ExecuteQuery();
}
}
} |