TermSet.GetTerms method (String, Boolean)
Gets a collection of all Term objects from the current TermSet that have 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 TermSet
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.StringThe Label of the Term to get
trimUnavailable
Type: System.BooleanA Boolean indicating whether to trim out Term objects that have the IsAvailableForTagging property set to false.
Return value
Type: Microsoft.SharePoint.Taxonomy.TermCollection
A collection of all Term objects from the current TermSet wit h a Label matching the provided string.
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. |
Remarks
If trimUnavailable is true, then Term objects with the IsAvailableForTagging property set to false will be trimmed from the results; otherwise all Term objects will be returned regardless of their IsAvailableForTagging value. All Label objects in all working languages will be searched by this method. The search is case-insensitive. A maximum of 100 results will be returned from this search.
The termLabel cannot be a null reference (Nothing in Visual Basic) 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, Microsoft recommends that any pending changes be committed to the database using the CommitAll() method before you execute this search.
See also
Reference
Microsoft.SharePoint.Taxonomy namespace
GetTerms(String, Boolean, StringMatchOption, Int32, Boolean)
GetTerms(String, Int32, Boolean)
GetTerms(String, Int32, Boolean, StringMatchOption, Int32, Boolean)