Share via


Term.GetTerms method (String, Int32, Boolean, StringMatchOption, Int32, Boolean)

Returns all Term instances that are descendants of the current Term with a label in the provided lcid matching the string provided. It only checks default Labels if defaultLabelOnly is provided to be true.

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

Syntax

'Declaration
Public Function GetTerms ( _
    termLabel As String, _
    lcid As Integer, _
    defaultLabelOnly As Boolean, _
    stringMatchOption As StringMatchOption, _
    resultCollectionSize As Integer, _
    trimUnavailable As Boolean _
) As TermCollection
'Usage
Dim instance As Term
Dim termLabel As String
Dim lcid As Integer
Dim defaultLabelOnly As Boolean
Dim stringMatchOption As StringMatchOption
Dim resultCollectionSize As Integer
Dim trimUnavailable As Boolean
Dim returnValue As TermCollection

returnValue = instance.GetTerms(termLabel, _
    lcid, defaultLabelOnly, stringMatchOption, _
    resultCollectionSize, trimUnavailable)
public TermCollection GetTerms(
    string termLabel,
    int lcid,
    bool defaultLabelOnly,
    StringMatchOption stringMatchOption,
    int resultCollectionSize,
    bool trimUnavailable
)

Parameters

  • lcid
    Type: System.Int32

    This method only searches labels in this lcid.

  • defaultLabelOnly
    Type: System.Boolean

    whether to search only default Labels

  • resultCollectionSize
    Type: System.Int32

    maximum number of results returned

  • trimUnavailable
    Type: System.Boolean

    whether to include not available for tagging term in the results

Return value

Type: Microsoft.SharePoint.Taxonomy.TermCollection
The TermCollection that matchs the search criteria

Exceptions

Exception Condition
ArgumentOutOfRangeException

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

ArgumentException

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

ArgumentNullException

The label name is null or an empty string.

Remarks

The termLabel 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 and cannot exceed 255 characters, and cannot contain anyof the following characters; " < > | & tab

The search results are directly from term store. It may not be in sync with whatever changes that has been made but not committed. To get bestresults, call CommitAll or RollbackAll before call this method.

See also

Reference

Term class

Term members

GetTerms overload

Microsoft.SharePoint.Taxonomy namespace

StringMatchOption