TermStore.GetTerms Method

Definition

Overloads

GetTerms(Guid[])

Gets a collection of Term objects based on the ID of the Term.

GetTerms(String, Boolean)

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

GetTerms(String, Int32, Boolean)

Returns a collection of all Term objects from all TermSet objects in this TermStore that the current user has permissions to read with a label in the provided LCID matching the string provided.

GetTerms(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.

GetTerms(String, Int32, Boolean, StringMatchOption, Int32, Boolean, Boolean, Boolean)

Gets a collection of all Term objects from all TermSet objects in this TermStore object 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, and options to trim certain terms.

GetTerms(Guid[])

Gets a collection of Term objects based on the ID of the Term.

public:
 Microsoft::SharePoint::Taxonomy::TermCollection ^ GetTerms(cli::array <Guid> ^ termIds);
[Microsoft.SharePoint.Client.ClientCallable(ClientLibraryTargets=Microsoft.SharePoint.Client.ClientLibraryTargets.NonRESTful, Name="GetTermsById")]
public Microsoft.SharePoint.Taxonomy.TermCollection GetTerms (Guid[] termIds);
member this.GetTerms : Guid[] -> Microsoft.SharePoint.Taxonomy.TermCollection
Public Function GetTerms (termIds As Guid()) As TermCollection

Parameters

termIds
Guid[]

The IDs of the Term objects to be retrieved

Returns

TermCollection

A collection of Term objects that are based on the ID of the Term, or an empty collection or a null reference (Nothing in Visual Basic) if no terms match.

Attributes
ClientCallableAttribute

Exceptions

The termIds parameter cannot be a null reference (Nothing in Visual Basic).

Remarks

If a Term is a member of multiple TermSet objects, it arbitrarily returns the Term from one of the TermSet objects. If an ID from termIds cannot be matched against the ID of a term in this TermStore object or if the user does not have sufficient permissions to access it, the term will not be included in the result collection that is returned. This method searches for the Term across all of the child groups and term sets that the user has permissions to read.

If the termIds list contains duplicate IDs, the returned item collection also contains duplicates. If this search finds no terms, then either a null reference (Nothing in Visual Basic) or an empty collection will be returned.

Applies to

GetTerms(String, Boolean)

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

public:
 Microsoft::SharePoint::Taxonomy::TermCollection ^ GetTerms(System::String ^ termLabel, bool trimUnavailable);
public Microsoft.SharePoint.Taxonomy.TermCollection GetTerms (string termLabel, bool trimUnavailable);
member this.GetTerms : string * bool -> Microsoft.SharePoint.Taxonomy.TermCollection
Public Function GetTerms (termLabel As String, trimUnavailable As Boolean) As TermCollection

Parameters

termLabel
String

The Label of the Term to retrieve

trimUnavailable
Boolean

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

Returns

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.

Exceptions

The termLabel cannot be a null reference (Nothing in Visual Basic) or empty.

The value of termLabel is invalid. It probably containsinvalid characters or is too long.

Remarks

If trimUnavailable is set to true, then terms that have IsAvailableForTagging set to false will be trimmed from the results; otherwise, all terms 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 returns a maimum of 100 results.

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.

Applies to

GetTerms(String, Int32, Boolean)

Returns a collection of all Term objects from all TermSet objects in this TermStore that the current user has permissions to read with a label in the provided LCID matching the string provided.

public:
 Microsoft::SharePoint::Taxonomy::TermCollection ^ GetTerms(System::String ^ termLabel, int lcid, bool trimUnavailable);
public Microsoft.SharePoint.Taxonomy.TermCollection GetTerms (string termLabel, int lcid, bool trimUnavailable);
member this.GetTerms : string * int * bool -> Microsoft.SharePoint.Taxonomy.TermCollection
Public Function GetTerms (termLabel As String, lcid As Integer, trimUnavailable As Boolean) As TermCollection

Parameters

termLabel
String

The Label of the Term to get

lcid
Int32

The locale identifier of the Term Labels to be matched.

trimUnavailable
Boolean

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

Returns

TermCollection

A collection of all T:Microsoft.SharePoint.Taxonomy.Term objects from all TermSet objects in this TermStore object that the current user has permissions to read with a Label in the specified LCID that matches the string provided.

Exceptions

The termLabel cannot be a null reference (Nothing in Visual Basic) or empty.

The value of termLabel is invalid. It probably contains invalid characters or is too long.

The lcid value must be one of the working languages in the current term store.

Remarks

If trimUnavailable is set to true, then terms that have the IsAvailableForTagging set to false will be trimmed from the results; otherwise all terms will be returned regardless of their IsAvailableForTagging value. All Term.Labels in the language matching the lcid parameter will be searched by this method. The search is case-insensitive, and a maximum of 100 results will be returned. 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.

The lcid value must be one of the working languages of the term store, specified by TermStore.Languages. 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.

Applies to

GetTerms(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.

public:
 Microsoft::SharePoint::Taxonomy::TermCollection ^ GetTerms(System::String ^ termLabel, bool defaultLabelOnly, Microsoft::SharePoint::Taxonomy::StringMatchOption stringMatchOption, int resultCollectionSize, bool trimUnavailable);
public Microsoft.SharePoint.Taxonomy.TermCollection GetTerms (string termLabel, bool defaultLabelOnly, Microsoft.SharePoint.Taxonomy.StringMatchOption stringMatchOption, int resultCollectionSize, bool trimUnavailable);
member this.GetTerms : string * bool * Microsoft.SharePoint.Taxonomy.StringMatchOption * int * bool -> Microsoft.SharePoint.Taxonomy.TermCollection

Parameters

termLabel
String

The Label of the Term to get

defaultLabelOnly
Boolean

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

stringMatchOption
StringMatchOption

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

resultCollectionSize
Int32

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

trimUnavailable
Boolean

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

Returns

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.

Exceptions

The termLabel cannot be a null reference (Nothing in Visual Basic) or empty.

The value of termLabel is invalid. It probably contains invalid characters or is too long.

Remarks

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.

Applies to

GetTerms(String, Int32, Boolean, StringMatchOption, Int32, Boolean, Boolean, Boolean)

Gets a collection of all Term objects from all TermSet objects in this TermStore object 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, and options to trim certain terms.

public:
 Microsoft::SharePoint::Taxonomy::TermCollection ^ GetTerms(System::String ^ termLabel, int lcid, bool defaultLabelOnly, Microsoft::SharePoint::Taxonomy::StringMatchOption stringMatchOption, int resultCollectionSize, bool trimUnavailable, bool trimDeprecated, bool excludeKeyword);
public Microsoft.SharePoint.Taxonomy.TermCollection GetTerms (string termLabel, int lcid, bool defaultLabelOnly, Microsoft.SharePoint.Taxonomy.StringMatchOption stringMatchOption, int resultCollectionSize, bool trimUnavailable, bool trimDeprecated, bool excludeKeyword);
member this.GetTerms : string * int * bool * Microsoft.SharePoint.Taxonomy.StringMatchOption * int * bool * bool * bool -> Microsoft.SharePoint.Taxonomy.TermCollection

Parameters

termLabel
String

The Label of the Term to retrieve

lcid
Int32

The locale identifier of the Term Labels to be matched.

defaultLabelOnly
Boolean

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

stringMatchOption
StringMatchOption

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

resultCollectionSize
Int32

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

trimUnavailable
Boolean

A boolean indicating whether to trim out terms that have Term.IsAvailableForTagging set to false.

trimDeprecated
Boolean

A boolean indicating whether to trim out terms that have Term.IsDeprecated set to true.

excludeKeyword
Boolean

A boolean indicating whether to exclude terms that are in the keywords TermSet

Returns

TermCollection

A collection of all Term objects from all TermSets 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, and options to trim certain terms

Exceptions

The termLabel cannot be null or empty.

The value of termLabel is invalid. It probably contains invalid characters or is too long.

Remarks

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.

If trimDeprecated is true then terms that have Term.IsDeprecated set to true will be trimmed from the results; otherwise all terms will be returned regardless of their Term.IsDeprecated value.

If excludeKeyword is true then terms in the keywords termset will be excluded from the search; otherwise all terms include keywords will be included in the search.

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.

Applies to