TaxonomyField.SetFieldValue method (SPListItem, Term, Int32)

Sets the value of the corresponding field in the list item to the properties of the specified Term in the specified language.

Namespace:  Microsoft.SharePoint.Taxonomy
Assembly:  Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)

public void SetFieldValue(
	SPListItem item,
	Term term,
	int lcid
)

Parameters

item
Type: Microsoft.SharePoint.SPListItem

The SPListItem object whose field is to be updated.

term
Type: Microsoft.SharePoint.Taxonomy.Term

The Term object whose properties are used to update the field value.

lcid
Type: System.Int32

The language code identifier (LCID) of the language of the default Label to use.

ExceptionCondition
ArgumentException

One or more arguments to this method are a null reference (Nothing in Visual Basic).

A Term has a maximum of one default Label for every new language in the TermStore object. The default Label used by this method is The default Label of the Term in the language specified by the lcid parameter, if one exists, otherwise the default language of the TermStore is used.

If the AllowMultipleValues property is true, the field will be assigned a TaxonomyFieldValueCollection object. Otherwise, it will be assigned a TaxonomyFieldValue object.

Show: