TermSet.GetTerms Method (String, Int32, Boolean)
Gets a collection of all Term objects from the current TermSet object with a Label in the specified 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 TermSet
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
termLabel
Type: System.StringThe Label of the Term to get
lcid
Type: System.Int32The locale identifier of the Labels to be matched.
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 object in the provided LCID matching 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 TermStore object. |
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 property value. All Term.Label objects in the language matching the lcid parameter 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. The lcid value must be one of the working languages of the TermStore object, specified by the Languages() property. To get the most accurate results, Microsoft recommend using the CommitAll() method to commit changes to the database before executing this search.
See Also
Reference
Microsoft.SharePoint.Taxonomy Namespace
Languages()
GetTerms(String, Boolean, StringMatchOption, Int32, Boolean)
GetTerms(String, Int32, Boolean, StringMatchOption, Int32, Boolean)