TermStore.GetTermsWithCustomProperty Method (String, String, Boolean)
Gets a collection of all Term objects, from all TermSet objects in this TermStore object that the current user has permissions to read, that have a custom property with the specified property name and the specified 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, _
trimUnavailable As Boolean _
) As TermCollection
'Usage
Dim instance As TermStore
Dim customPropertyName As String
Dim customPropertyValue As String
Dim trimUnavailable As Boolean
Dim returnValue As TermCollection
returnValue = instance.GetTermsWithCustomProperty(customPropertyName, _
customPropertyValue, trimUnavailable)
public TermCollection GetTermsWithCustomProperty(
string customPropertyName,
string customPropertyValue,
bool trimUnavailable
)
Parameters
customPropertyName
Type: System.StringThe custom property name
customPropertyValue
Type: System.StringThe custom property value
trimUnavailable
Type: System.BooleanA 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 TermSet objects in this TermStore that the current user has permissions to read, that have a custom property with 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 invalid character '\t', '\n', or both. |
Remarks
If trimUnavailable is true then terms that have Term.IsAvailableForTagging set to false will be trimmedfrom the results; otherwise all matching terms will be returned regardless of their Term.IsAvailableForTagging 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 search is case-insensitive. A maximum of 100 results will be returned from this search. To get the most accurate results it is recommended that any pending changes be committed to the database using CommitAll() before executing this search.
See Also
Reference
GetTermsWithCustomProperty Overload
Microsoft.SharePoint.Taxonomy Namespace
GetTermsWithCustomProperty(String, Boolean)
GetTermsWithCustomProperty(String, Int32, Boolean)
GetTermsWithCustomProperty(String, String, StringMatchOption, Boolean)
GetTermsWithCustomProperty(String, String, StringMatchOption, Int32, Boolean)