3.1.5.20.2.2.6 GetTerms

Return Type: Microsoft.SharePoint.Client.Taxonomy.TermCollection

Gets a collection of all Term (section 3.1.5.16) objects from the current TermSet (section 3.1.5.20) object based on the label criteria provided.

Remarks:

The LabelMatchInformation values that are set MUST be one of these combinations:

  • LabelMatchInformation.TermLabel and LabelMatchInformation.TrimUnavailable.

  • LabelMatchInformation.TermLabel, LabelMatchInformation.Lcid, and LabelMatchInformation.TrimUnavailable.

  • LabelMatchInformation.TermLabel, LabelMatchInformation.DefaultLabelOnly, LabelMatchInformation.StringMatchOption, LabelMatchInformation.ResultCollectionSize, and LabelMatchInformation.TrimUnavailable.

  • LabelMatchInformation.TermLabel, LabelMatchInformation.Lcid, LabelMatchInformation.DefaultLabelOnly, LabelMatchInformation.StringMatchOption, LabelMatchInformation.ResultCollectionSize, and LabelMatchInformation.TrimUnavailable.

If the combination of LabelMatchInformation (section 3.1.5.30) values is invalid, an ArgumentException or ArgumentNullException will be thrown indicating the invalid setting.

The LabelMatchInformation.TermLabel (section 3.1.5.30.1.1.6) 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 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 LabelMatchInformation.StringMatchOption (section 3.1.5.30.1.1.5) parameter. If the LabelMatchInformation.StringMatchOption is not set, it defaults to exact match.

If LabelMatchInformation.TrimUnavailable (section 3.1.5.30.1.1.8) is true, then terms that have Term.IsAvailableForTagging (section 3.1.5.16.1.1.5) set to false will be trimmed from the results; otherwise, all terms will be returned regardless of their Term.IsAvailableForTagging value.

If LabelMatchInformation.Lcid (section 3.1.5.30.1.1.3) is specified, then a Term will be returned if a Label in the specified Lcid matches the string provided. If no Lcid is specified, then all Term.Labels (section 3.1.5.16.1.2.1) in all working languages will be searched by this method. The lcid value MUST be one of the working languages of the term store, specified by TermStore.Languages (section 3.1.5.23.1.1.4).

If LabelMatchInformation.DefaultLabelOnly (section 3.1.5.30.1.1.1) is true, then only the default labels will be searched.

The maximum number of results returned from this search is restricted by the LabelMatchInformation.ResultCollectionSize (section 3.1.5.30.1.1.4) parameter. If LabelMatchInformation.ResultCollectionSize is not set, then a maximum of 100 results is returned.

To get the most accurate results, it is recommended that any pending changes be committed to the database using CommitAll (section 3.1.5.23.2.1.1) prior to executing this search.

Exceptions:

Error Code

Error Type Name

Condition

-2147024809

ArgumentException

Incorrect combination of LabelMatchInformation settings provided.

-2147024809

ArgumentException

Invalid value provided for one of the LabelMatchInformation settings.

-2147024809

ArgumentException

The value of LabelMatchInformation.TermLabel is invalid. It either contains invalid characters or is too long.

-2147467261

ArgumentNullException

Some LabelMatchInformation settings cannot be null or empty.

-2147467261

ArgumentNullException

The LabelMatchInformation.TermLabel cannot be null or empty.

-2146233086

ArgumentOutOfRangeException

The LabelMatchInformation.Lcid value MUST be one of the working languages in the current TermStore.

Parameters:

labelMatchInformation: Indicates the search criteria to use when retrieving Term objects.

Type: Microsoft.SharePoint.Client.Taxonomy.LabelMatchInformation