This topic has not yet been rated - Rate this topic

TermSetItem.CreateTerm Method (String, Int32)

SharePoint 2010

Creates a new Term below this TaxonomyItem instance.The name is the default Label for the LCID specified.

Namespace:  Microsoft.SharePoint.Taxonomy
Assembly:  Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)
public Term CreateTerm(
	string name,
	int lcid
)

Parameters

name
Type: System.String
Default label for the lcid
lcid
Type: System.Int32
LCID to create the label on

Return Value

Type: Microsoft.SharePoint.Taxonomy.Term
The newly created Term object
Exception Condition
UnauthorizedAccessException

The user does not have sufficient permission to perform this operation.

TermStoreOperationException

This operation is invalid in the Orphaned Terms term set.The operation failed.

TermStoreOperationException

Keyword term set only allows a flat list of Terms.

ArgumentException

The name is not valid, it contains invalid characters or is too long.

ArgumentNullException

The name is null or empty string.

ArgumentOutOfRangeException

The LCID is not valid.

If the TaxonomyTermSet object for this TaxonomyItem is not an open TermSet then the current user must have EditTerm permissions in order to use this method.

If the specified lcid is not the default language of the TermStore, a Label with the name and the default language of the TermStore will also be created to ensure the Term has a default Label for the default language of the TermStore.

If the current TermSetItem is the Keyword Term Set, then label is always created for the term store default language.

The name value will be normailized to trim consecutive spaces into one and replace the & character with the wide character version of the character (\uFF06). The leading and trailing spaces will be trimmed. It must be non-empty and cannot exceed 255 characters, and cannot contain any of the following characters ; "<>|&tab.

The current user will be set as the owner of the new Term.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ