Compartilhar via


TermStore.GetTerms Method (String, 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 object that matches the string provided in any LCID.

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

Syntax

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

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

Parameters

  • termLabel
    Type: System.String

    The Label of the Term to retrieve

Return Value

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

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 containsinvalid characters or is too long.

Remarks

If trimUnavailable is set to true, then terms that have 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 all working languages will be searched by this method. The search is case-insensitive, and returns a maimum of 100 results.

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

Labels

IsAvailableForTagging

GetTerms([])

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

GetTerms(String, Int32, Boolean)

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