TaxonomyClientService.AddTerms Method

Adds a new Term to the managed metadata TermStore object.

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

Syntax

'Declaration
<WebMethodAttribute> _
Public Function AddTerms ( _
    sharedServiceId As Guid, _
    termSetId As Guid, _
    lcid As Integer, _
    newTerms As String _
) As String
'Usage
Dim instance As TaxonomyClientService
Dim sharedServiceId As Guid
Dim termSetId As Guid
Dim lcid As Integer
Dim newTerms As String
Dim returnValue As String

returnValue = instance.AddTerms(sharedServiceId, _
    termSetId, lcid, newTerms)
[WebMethodAttribute]
public string AddTerms(
    Guid sharedServiceId,
    Guid termSetId,
    int lcid,
    string newTerms
)

Parameters

  • sharedServiceId
    Type: System.Guid

    TermStore Id of TermSet to add Term in.

  • lcid
    Type: System.Int32

    The language that the label will be added in.

Return Value

Type: System.String
ID of the newly added Term.

Exceptions

Exception Condition
UnauthorizedAccessException

Thrown if user does not have access to the root web of the current context.

ArgumentOutOfRangeException

Thrown if a TermStore with ID sharedServiceId does not exist. Also, thrown if you try to add a new Term under another Term (parentTermId is not the empty GUID), and you are trying to add to the keywords TermSet (TermSetId is the empty GUID).

NullReferenceException

Thrown if the TermSet with ID TermSetId does not exist.

ArgumentException

Thrown if the parentTermId is not the empty GUID and the Term does not exist in the TermSet with ID TermSetId.

Remarks

New Terms must be stored in XML nodes named NewTerm with an attribute label, attribute clientId and attribute parentTermid. You can have as many NewTerm nodes as needed. clientId is an int that the client used to uniquely identify the newTerm. The parentTermId must either be the GUID of another Term, or an empty GUID if the new Term should be at the root of the TermSet.

See Also

Reference

TaxonomyClientService Class

TaxonomyClientService Members

Microsoft.SharePoint.Taxonomy.WebServices Namespace