Group.CreateTermSet method (String, Guid)
Creates a new T:Microsoft.SharePoint.Taxonomy.TermSet object in this T:Microsoft.SharePoint.Taxonomy.Group object by using the working language of the TermStore object 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 _
) As TermSet
'Usage
Dim instance As Group
Dim name As String
Dim newTermSetId As Guid
Dim returnValue As TermSet
returnValue = instance.CreateTermSet(name, _
newTermSetId)
public TermSet CreateTermSet(
string name,
Guid newTermSetId
)
Parameters
name
Type: System.StringThe name of the TermSet being created
newTermSetId
Type: System.GuidThe unique identifier of the TermSet being created
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 TermSet in the same Group. |
ArgumentNullException | The name cannot be null or empty. |
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 object. The newTermSetId value must be a unique ID across all term sets in the term store.If it is already in use by another term set a TermStoreOperationException will be thrown during the CommitAll() transaction. The current user must have TaxonomyRights.EditTermSet permission to use this method. Call the CommitAll() method to save this change to the database.