Export (0) Print
Expand All

TermStore.GetTerms method (String, Boolean, StringMatchOption, Int32, Boolean)

Gets 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, with an option to only search default labels.

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

public TermCollection GetTerms(
	string termLabel,
	bool defaultLabelOnly,
	StringMatchOption stringMatchOption,
	int resultCollectionSize,
	bool trimUnavailable
)

Parameters

termLabel
Type: System.String

The Label of the Term to get

defaultLabelOnly
Type: System.Boolean

Indicates whether only default labels should be included in the search.

stringMatchOption
Type: Microsoft.SharePoint.Taxonomy.StringMatchOption

Indicates whether to search for labels that start with the specified string, or those that have an exact match.

resultCollectionSize
Type: System.Int32

Indicates the maximum number of Term objects to include in the returned TermCollection.

trimUnavailable
Type: System.Boolean

A Boolean indicating whether to trim out terms that have the IsAvailableForTagging property set to false.

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, with an option to only search default labels.

ExceptionCondition
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.

If trimUnavailable is true then terms that have Term.IsAvailableForTagging set to false will be trimmed from the results; otherwise all terms will be returned regardless of their Term.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 the stringMatchOption parameter. The maximum number of results returned from this search is restricted by the resultCollectionSize parameter. 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.

Community Additions

Show:
© 2014 Microsoft