TaxonomyField.SetFieldValue Method (SPListItem, TermCollection)
Sets the value of the corresponding multi-value field in the list item to the properties of the Term objects in the specified collection.
Namespace: Microsoft.SharePoint.Taxonomy
Assembly: Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)
Syntax
'Declaration
Public Sub SetFieldValue ( _
item As SPListItem, _
terms As TermCollection _
)
'Usage
Dim instance As TaxonomyField
Dim item As SPListItem
Dim terms As TermCollection
instance.SetFieldValue(item, terms)
public void SetFieldValue(
SPListItem item,
TermCollection terms
)
Parameters
item
Type: Microsoft.SharePoint.SPListItemThe SPListItem object whose field is to be updated.
terms
Type: Microsoft.SharePoint.Taxonomy.TermCollectionThe collection of Term objects whose properties are to be used to update the field value.
Exceptions
Exception | Condition |
---|---|
ArgumentException | One or more arguments to this method are a null reference (Nothing in Visual Basic), or the TaxonomyField object does not allow multiple values. |
Remarks
Each Term has a maximum of one default label for every language in the TermStore object. For each Term, The default Label in the default language of the TermStore is used.
The field will be assigned a TaxonomyFieldValueCollection object.