Term.GetTerms Method (String, Int32, Boolean, StringMatchOption, Int32, Boolean)
Returns all Term instances that are descendants of the current Term with a label in the provided lcid matching the string provided. It only checks default Labels if defaultLabelOnly is provided to be true.
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 _
) As TermCollection
'Usage
Dim instance As Term
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 returnValue As TermCollection
returnValue = instance.GetTerms(termLabel, _
lcid, defaultLabelOnly, stringMatchOption, _
resultCollectionSize, trimUnavailable)
public TermCollection GetTerms(
string termLabel,
int lcid,
bool defaultLabelOnly,
StringMatchOption stringMatchOption,
int resultCollectionSize,
bool trimUnavailable
)
Parameters
termLabel
Type: System.Stringthe term label to match against
lcid
Type: System.Int32This method only searches labels in this lcid.
defaultLabelOnly
Type: System.Booleanwhether to search only default Labels
stringMatchOption
Type: Microsoft.SharePoint.Taxonomy.StringMatchOptionWhether the search is exact match or start with
resultCollectionSize
Type: System.Int32maximum number of results returned
trimUnavailable
Type: System.Booleanwhether to include not available for tagging term in the results
Return Value
Type: Microsoft.SharePoint.Taxonomy.TermCollection
The TermCollection that matchs the search criteria
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | Call the M:Microsoft.SharePoint.Taxonomy.TermStore.CommitAll method to save this change to the database. is not valid. |
ArgumentException | The label name is not valid, it contains invalid characters or is too long. |
ArgumentNullException | The label name is null or an empty string. |
Remarks
The termLabel value will be normailized to trim consecutive spaces into one and replace the & character with the wide character version of the character (\uFF06). It must be non-empty and cannot exceed 255 characters, and cannot contain anyof the following characters; " < > | & tab
The search results are directly from term store. It may not be in sync with whatever changes that has been made but not committed. To get bestresults, call CommitAll or RollbackAll before call this method.