当我调试此代码时,它工作正常,但是在调试此代码之前,我运行此代码时遇到错误
由于保存冲突,术语更新失败
我该如何解决这个问题?
List<ImportTerms> level1TermItems = termItems.Where(cti =>
!String.IsNullOrEmpty(cti.Level1Term) &&
String.IsNullOrEmpty(cti.Level2Term)).ToList();
NavigationTerm childTerm = null;
foreach (ImportTerms level1TermItem in level1TermItems)
{
childTerm = termBrand.CreateTerm(level1TermItem.Level1Term, NavigationLinkType.SimpleLink, Guid.NewGuid());
childTerm.SimpleLinkUrl = "/sites/" + Consts.CONTENT_SEARCH_WEB_PART_SITE_URL + "/Pages/" + Consts.WEB_PART_PAGE_NAME + "?b=" + level1TermItem.Level1Term;
childTerm.GetTaxonomyTerm().TermStore.CommitAll();
ctx.ExecuteQuery();
childTerm = null;
}
ctx.ExecuteQuery();