本文整理汇总了C#中Term.ReuseTerm方法的典型用法代码示例。如果您正苦于以下问题:C# Term.ReuseTerm方法的具体用法?C# Term.ReuseTerm怎么用?C# Term.ReuseTerm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term.ReuseTerm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessSubTerms
private void ProcessSubTerms(ClientContext sourceClientContext, ClientContext targetClientContext, TermSet targetTermSet, Term targetTerm, Term sourceTerm, List<int> languagesToProcess, int defaultLanguage)
{
TermCollection sourceTerms = sourceTerm.Terms;
sourceClientContext.Load(sourceTerms, terms => terms.Include(
term => term.Name,
term => term.Description,
term => term.Id,
term => term.IsDeprecated,
term => term.IsAvailableForTagging,
term => term.LocalCustomProperties,
term => term.CustomProperties,
term => term.Labels.Include(label => label.Value, label => label.Language, label => label.IsDefaultForLanguage),
term => term.TermSet, termset => termset.Id));
sourceClientContext.ExecuteQuery();
foreach (Term subSourceTerm in sourceTerm.Terms)
{
Term reusedTerm = targetTerm.TermStore.GetTerm(subSourceTerm.Id);
targetClientContext.Load(reusedTerm);
targetClientContext.ExecuteQuery();
Term childTargetTerm;
if (reusedTerm.ServerObjectIsNull.Value)
{
childTargetTerm = targetTerm.CreateTerm(subSourceTerm.Name, defaultLanguage, subSourceTerm.Id);
targetClientContext.Load(childTargetTerm, term => term.IsDeprecated,
term => term.CustomProperties,
term => term.LocalCustomProperties);
targetClientContext.ExecuteQuery();
UpdateTerm(sourceClientContext, targetClientContext, subSourceTerm, childTargetTerm, languagesToProcess);
}
else
{
childTargetTerm = targetTerm.ReuseTerm(reusedTerm, false);
}
targetClientContext.Load(childTargetTerm);
targetClientContext.ExecuteQuery();
targetTermSet.TermStore.UpdateCache();
ProcessSubTerms(sourceClientContext, targetClientContext, targetTermSet, childTargetTerm, subSourceTerm, languagesToProcess, defaultLanguage);
}
}