3.1.5.16.2.2.3 CreateTerm

Return Type: Microsoft.SharePoint.Client.Taxonomy.Term

Creates a new Term (section 3.1.5.16) object under this TaxonomyItem (section 3.1.5.14) object. The name is the default Label (section 3.1.5.10) for the specified language code identifier (LCID).

Parameters:

name: Default label for the lcid.

Type: CSOM String

lcid: The LCID to create the Label for.

Type: CSOM Int32

newTermId: The GUID for the Term.

Type: CSOM GUID

Remarks:

If the specified LCID is not the default language of the TermStore (section 3.1.5.23), a Label (section 3.1.5.10) 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 (section 3.1.5.22) is the keyword TermSet, then the Label is created for the TermStore default language.

The Name value will be normalized to trim consecutive spaces into one and replace the "&" character with the wide character version of the character (\uFF06). It MUST NOT be empty, exceed 255 characters, or contain any of the following characters: ; " < > | & or the tab character.

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

If the newTermId already exists in the TermStore, an exception will be thrown.

Call the CommitAll (section 3.1.5.23.2.1.1) to save this change to the database.

Exceptions:

Error Code

Error Type Name

Condition

-2147024891

UnauthorizedAccessException

The protocol client has insufficient permissions to perform this operation.

-1

TermStoreOperationException

This operation is not valid in the orphaned terms term set (section 3.1.5.20). The operation failed.

-1

TermStoreOperationException

Keyword term set (section 3.1.5.20) only allows a flat list of Term objects.

-2147024809

ArgumentException

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

-2147467261

ArgumentNullException

The name is null or empty string.

-2146233086

ArgumentOutOfRangeException

The lcid is not valid.