share point 读取 metadata

时间:2021-07-31 03:51:32
private static void syncMetaData()
{
var siteUrl = @"http://...";
using (var site = new SPSite(siteUrl))
{
var session = new TaxonomySession(site);
foreach (var termStore in session.TermStores)
{
foreach (var group in termStore.Groups)
{
foreach (var termSet in group.TermSets)
{
SyncTerms(termSet.Terms);
}
}
}
}
}
private static void SyncTerms(TermCollection terms)
{
foreach (var term in terms)
{
SyncTerms(term.Terms);
}
}