Term.CreateLabel Method

Creates a new Label for this Term.

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

Syntax

'Declaration
Public Function CreateLabel ( _
    labelName As String, _
    lcid As Integer, _
    isDefault As Boolean _
) As Label
'Usage
Dim instance As Term
Dim labelName As String
Dim lcid As Integer
Dim isDefault As Boolean
Dim returnValue As Label

returnValue = instance.CreateLabel(labelName, _
    lcid, isDefault)
public Label CreateLabel(
    string labelName,
    int lcid,
    bool isDefault
)

Parameters

  • isDefault
    Type: System.Boolean

    Whether this Label will be the default Label of The lcid

Return Value

Type: Microsoft.SharePoint.Taxonomy.Label
The new Label for the Term

Exceptions

Exception Condition
UnauthorizedAccessException

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

TermStoreOperationException

This operation is invalid in the orphaned terms TermSet.The operation failed.

ArgumentException

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

ArgumentNullException

The label name is a null reference (Nothing in Visual Basic) or an empty string.

ArgumentOutOfRangeException

Call the M:Microsoft.SharePoint.Taxonomy.TermStore.CommitAll method to save this change to the database. is not valid.

ArgumentException

The label will be created as a none default Label, and the name already exists for this lcid.

Remarks

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

The name of the Label object is case-insensitive. If the name to be created is a non-default Label, it cannot have the same name as any existing Label of The lcid. If it is to be created as a default, then it can have the same name as existing Label. Instead of creating a new label, the existing label will become the default Label for the LCID.

The current user must have TaxonomyRights.EditTerm permissions to use this method.

See Also

Reference

Term Class

Term Members

Microsoft.SharePoint.Taxonomy Namespace