Group.CreateTermSet Method (String, Guid, Int32)
Creates a new TermSet object in the current Group object by using the provided language and the specified unique identifier.
Namespace: Microsoft.SharePoint.Taxonomy
Assembly: Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)
Syntax
'Declaration
Public Function CreateTermSet ( _
name As String, _
newTermSetId As Guid, _
lcid As Integer _
) As TermSet
'Usage
Dim instance As Group
Dim name As String
Dim newTermSetId As Guid
Dim lcid As Integer
Dim returnValue As TermSet
returnValue = instance.CreateTermSet(name, _
newTermSetId, lcid)
public TermSet CreateTermSet(
string name,
Guid newTermSetId,
int lcid
)
Parameters
name
Type: System.StringThe name of the new TermSet object that is being created
newTermSetId
Type: System.GuidThe unique identifier of the new TermSet object that is being created
lcid
Type: System.Int32The language that the new TermSet name is written in
Return Value
Type: Microsoft.SharePoint.Taxonomy.TermSet
The newly created TermSet object
Exceptions
Exception | Condition |
---|---|
UnauthorizedAccessException | The current user has insufficient permissions to perform this operation. |
TermStoreOperationException | Creating a term set in system group is disallowed. |
ArgumentException | The name parameter is invalid. It either contains invalid characters, is too long, or conflicts with the name of an existing term set in the same group. |
ArgumentNullException | The name cannot be a null reference (Nothing in Visual Basic) or empty. |
ArgumentOutOfRangeException | The lcid is not one of the working languages for the term store |
Remarks
The name cannot exceed 255 characters, and it cannot contain any of the following illegal characters
- ; " < > | & tab
Additionally the name parameter must be a unique TermSet name within the current Group and the newTermSetId value must be a unique ID across all TermSet objects in the TermStore. If it is already in use by another TermSet object, a TermStoreOperationException exception will be thrown during the CommitAll() transaction.The current user must have TaxonomyRights.EditTermSet permission to use this method. Call CommitAll() to save this change to the database.