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
オブジェクトに用語を追加して、フィールドに用語の値を保存する方法を知っていますか?
ありがとうございました。