TermSet.GetTerms Method (String, Boolean, StringMatchOption, Int32, Boolean)
Gets a collection of all Term objects from the current TermSet object with a Label matchingthe string provided in any LCID, with an option to only search default labels.
Namespace: Microsoft.SharePoint.Taxonomy
Assembly: Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)
Syntax
'Declaration
Public Function GetTerms ( _
termLabel As String, _
defaultLabelOnly As Boolean, _
stringMatchOption As StringMatchOption, _
resultCollectionSize As Integer, _
trimUnavailable As Boolean _
) As TermCollection
'Usage
Dim instance As TermSet
Dim termLabel As String
Dim defaultLabelOnly As Boolean
Dim stringMatchOption As StringMatchOption
Dim resultCollectionSize As Integer
Dim trimUnavailable As Boolean
Dim returnValue As TermCollection
returnValue = instance.GetTerms(termLabel, _
defaultLabelOnly, stringMatchOption, _
resultCollectionSize, trimUnavailable)
public TermCollection GetTerms(
string termLabel,
bool defaultLabelOnly,
StringMatchOption stringMatchOption,
int resultCollectionSize,
bool trimUnavailable
)
Parameters
termLabel
Type: System.StringThe Label of the Term to get
defaultLabelOnly
Type: System.Booleantrue if default labels should be included in the search; otherwise, false
stringMatchOption
Type: Microsoft.SharePoint.Taxonomy.StringMatchOptionWhether to search for labels that start with the specified string, or those that have an exact match.
resultCollectionSize
Type: System.Int32The maximum number of Term objects to include in the returned TermCollection object.
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 with a Label matching the string provided in any LCID, with an option to only search default labels.
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 Term.Labels in all working languages will be searched by this method. 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 thestringMatchOption parameter. The maximum number of results returned from this search is restricted by the resultCollectionSize parameter.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 using the CommitAll() method to commit changes to the database before to executing this search.
See Also
Reference
Microsoft.SharePoint.Taxonomy Namespace
GetTerms(String, Int32, Boolean)
GetTerms(String, Int32, Boolean, StringMatchOption, Int32, Boolean)