Compartilhar via


TermStore.GetTermsWithCustomProperty Method (String, Int32, Boolean)

This method retrieves a collection of all Term objects, from all TermSets in this TermStore that the current user has permissions to read, that have a custom property with the provided property name.

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

Syntax

'Declaration
Public Function GetTermsWithCustomProperty ( _
    customPropertyName As String, _
    resultCollectionSize As Integer, _
    trimUnavailable As Boolean _
) As TermCollection
'Usage
Dim instance As TermStore
Dim customPropertyName As String
Dim resultCollectionSize As Integer
Dim trimUnavailable As Boolean
Dim returnValue As TermCollection

returnValue = instance.GetTermsWithCustomProperty(customPropertyName, _
    resultCollectionSize, trimUnavailable)
public TermCollection GetTermsWithCustomProperty(
    string customPropertyName,
    int resultCollectionSize,
    bool trimUnavailable
)

Parameters

  • customPropertyName
    Type: System.String

    The custom property name

  • 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 Term.IsAvailableForTagging set to false.

Return Value

Type: Microsoft.SharePoint.Taxonomy.TermCollection
A collection of all Term objects, from all TermSets in this TermStore that the current user has permissions to read, that have a custom property with the provided property name.

Exceptions

Exception Condition
ArgumentNullException

The customPropertyName cannot be null or empty.

ArgumentException

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

ArgumentOutOfRangeException

The resultCollectionSize value is invalid. It must be greater than 0.

Remarks

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

See Also

Reference

TermStore Class

TermStore Members

GetTermsWithCustomProperty Overload

Microsoft.SharePoint.Taxonomy Namespace

CustomProperties

GetTermsWithCustomProperty(String, Boolean)

GetTermsWithCustomProperty(String, String, StringMatchOption, Boolean)

GetTermsWithCustomProperty(String, String, StringMatchOption, Int32, Boolean)

GetTermsWithCustomProperty(String, String, Boolean)