TermSet.GetTermsWithCustomProperty Method (String, String, StringMatchOption, Int32, Boolean)
Gets a collection of Term objects with a custom property starting with or matching the provided property name and the provided property value.
Namespace: Microsoft.SharePoint.Taxonomy
Assembly: Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)
Syntax
'Declaration
Public Function GetTermsWithCustomProperty ( _
customPropertyName As String, _
customPropertyValue As String, _
stringMatchOption As StringMatchOption, _
resultCollectionSize As Integer, _
trimUnavailable As Boolean _
) As TermCollection
'Usage
Dim instance As TermSet
Dim customPropertyName As String
Dim customPropertyValue As String
Dim stringMatchOption As StringMatchOption
Dim resultCollectionSize As Integer
Dim trimUnavailable As Boolean
Dim returnValue As TermCollection
returnValue = instance.GetTermsWithCustomProperty(customPropertyName, _
customPropertyValue, stringMatchOption, _
resultCollectionSize, trimUnavailable)
public TermCollection GetTermsWithCustomProperty(
string customPropertyName,
string customPropertyValue,
StringMatchOption stringMatchOption,
int resultCollectionSize,
bool trimUnavailable
)
Parameters
customPropertyName
Type: System.StringThe custom property name
customPropertyValue
Type: System.StringThe custom property value
stringMatchOption
Type: Microsoft.SharePoint.Taxonomy.StringMatchOptionWhether to search for custom property names and values that start withthe specified strings, or search for those that exactly match the specified strings.
resultCollectionSize
Type: System.Int32The maximum number of Term objects to include in the returned TermCollection object.
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 Term objects with a custom property starting with or matching the provided property name and the provided property value.
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. |
ArgumentNullException | The customPropertyValue cannot be null or empty. |
ArgumentException | The value of customPropertyValue is invalid. It exceeds the maximum allowed length 255. |
ArgumentException | The value of customPropertyValue is invalid. It contains invalidcharacter \t, \n, or both. |
ArgumentOutOfRangeException | The resultCollectionSize is invalid. It must be greater than 0. |
Remarks
If trimUnavailable is true, then Term objects with the IsAvailableForTagging property set to false will be trimmed from the results; otherwise all matching terms will be returned regardless of their IsAvailableForTagging property value.The customPropertyName 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 customPropertyValue cannot be null or empty, and must not exceed 255 characters in length. It also cannot contain any of the illegal characters \t or \n. The resultCollectionSize value must be greater than 0.The search is case-insensitive. The maximum number of results returned from this search is restrictedby the resultCollectionSize parameter. To get the most accurate results, Microsoft recommends using the CommitAll() method to commit results to the database before executing this search.
See Also
Reference
GetTermsWithCustomProperty Overload
Microsoft.SharePoint.Taxonomy Namespace
GetTermsWithCustomProperty(String, Boolean)
GetTermsWithCustomProperty(String, Int32, Boolean)
GetTermsWithCustomProperty(String, String, Boolean)
GetTermsWithCustomProperty(String, String, StringMatchOption, Boolean)