TermStore.GetTerms Method (String, Int32, Boolean)

Returns a collection of all Term objects from all TermSet objects in this TermStore that the current user has permissions to read with a label in the provided LCID matching the string provided.

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

Syntax

'Declaration
Public Function GetTerms ( _
    termLabel As String, _
    lcid As Integer, _
    trimUnavailable As Boolean _
) As TermCollection
'Usage
Dim instance As TermStore
Dim termLabel As String
Dim lcid As Integer
Dim trimUnavailable As Boolean
Dim returnValue As TermCollection

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

Parameters

  • lcid
    Type: System.Int32

    The locale identifier of the Term Labels to be matched.

Return Value

Type: Microsoft.SharePoint.Taxonomy.TermCollection
A collection of all T:Microsoft.SharePoint.Taxonomy.Term objects from all TermSet objects in this TermStore object that the current user has permissions to read with a Label in the specified LCID that matches the string provided.

Exceptions

Exception Condition
ArgumentNullException

The termLabel cannot be a null reference (Nothing in Visual Basic) or empty.

ArgumentException

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

ArgumentOutOfRangeException

The lcid value must be one of the working languages in the current term store.

Remarks

If trimUnavailable is set to true, then terms that have the IsAvailableForTagging set to false will be trimmed from the results; otherwise all terms will be returned regardless of their IsAvailableForTagging value. All Term.Labels in the language matching the lcid parameter will be searched by this method. The search is case-insensitive, and a maximum of 100 results will be returned. 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.

The lcid value must be one of the working languages of the term store, specified by TermStore.Languages. 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, StringMatchOption, Int32, Boolean, Boolean, Boolean)