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

Gets a collection of all Term objects from all TermSet objects in this TermStore object that the current user has permissions to read with a Label matching the string provided in any LCID, with an option to only search default labels, and options to trim certain terms.

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, _
    trimDeprecated As Boolean, _
    excludeKeyword As Boolean _
) As TermCollection
'Usage
Dim instance As TermStore
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 trimDeprecated As Boolean
Dim excludeKeyword As Boolean
Dim returnValue As TermCollection

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

Parameters

  • termLabel
    Type: System.String

    The Label of the Term to retrieve

  • lcid
    Type: System.Int32

    The locale identifier of the Term Labels to be matched.

  • defaultLabelOnly
    Type: System.Boolean

    Indicates whether only default labels should be included in the search.

  • resultCollectionSize
    Type: System.Int32

    Indicates the maximum number of Term objects to include in the returned TermCollection.

  • trimUnavailable
    Type: System.Boolean

    A boolean indicating whether to trim out terms that have Term.IsAvailableForTagging set to false.

  • trimDeprecated
    Type: System.Boolean

    A boolean indicating whether to trim out terms that have Term.IsDeprecated set to true.

  • excludeKeyword
    Type: System.Boolean

    A boolean indicating whether to exclude terms that are in the keywords TermSet

Return value

Type: Microsoft.SharePoint.Taxonomy.TermCollection
A collection of all Term objects from all TermSets in this TermStore that the current user has permissions to read with a Label matching the string provided in any LCID, with an option to only search default labels, and options to trim certain terms

Exceptions

Exception Condition
ArgumentNullException

The termLabel cannot be null or empty.

ArgumentException

The value of termLabel is invalid. It probably contains invalid characters or is too long.

Remarks

If trimUnavailable is true then terms that have Term.IsAvailableForTagging set to false will be trimmed from the results; otherwise all terms will be returned regardless of their Term.IsAvailableForTagging value.

If trimDeprecated is true then terms that have Term.IsDeprecated set to true will be trimmed from the results; otherwise all terms will be returned regardless of their Term.IsDeprecated value.

If excludeKeyword is true then terms in the keywords termset will be excluded from the search; otherwise all terms include keywords will be included in the search.

The search is case-insensitive, and will match either the entire label or only check that it starts with the specified string depending on the value of the stringMatchOption parameter.

The maximum number of results returned from this search is restricted by the resultCollectionSize parameter.

The termLabel cannot be null or empty, and must not exceed 255 characters in length.

It also cannot contain any of the following illegal characters: ;"<>|&tab

To get the most accurate results it is recommended that any pending changes be committed to the database using CommitAll() prior to executing this search.

See also

Reference

TermStore class

TermStore members

GetTerms overload

Microsoft.SharePoint.Taxonomy namespace

Language

Languages

GetTerms([])

GetTerms(String, Boolean)

GetTerms(String, Boolean, StringMatchOption, Int32, Boolean)

GetTerms(String, Int32, Boolean)