【发布时间】:2011-11-30 16:37:18
【问题描述】:
在 sharePoint 2010 中,我想设置文档字段的分类值。该字段可以采用多个分类术语。
我做错了,因为taxoTerms.Concat(terms) 在TermCollection 类中的演员阵容失败:
TaxonomyField taxoField = file.Item.Fields.GetFieldByInternalName(entry.Key)
as TaxonomyField;
TaxonomySession taxoSession = new TaxonomySession(web.Site);
TermStore store = taxoSession.TermStores[taxoField.SspId];
TermSet termSet = store.GetTermSet(taxoField.TermSetId);
if (taxoField.AllowMultipleValues)
{
string[] taxoValues = entry.Value.Split(';');
TermCollection taxoTerms = termSet.GetTerms(taxoValues[0], true);
for (int j = 1; j < taxoValues.Length; j++)
{
TermCollection terms = termSet.GetTerms(taxoValues[j], true);
if (terms.Count > 0)
{
taxoTerms = (TermCollection)taxoTerms.Concat(terms);
}
}
taxoField.SetFieldValue(file.Item, taxoTerms);
}
您知道如何将术语添加到我的 TermCollection 对象中,以便将术语值保存在字段中吗?
【问题讨论】:
标签: sharepoint taxonomy