public TermCollectionInstance GetTermsWithCustomProperty(string customPropertyName, string customPropertyValue, string stringMatchOption, int resultCollectionSize, bool trimUnavailable) { var stringMatchOptionEnum = (StringMatchOption)Enum.Parse(typeof(StringMatchOption), stringMatchOption); var result = m_taxonomySession.GetTermsWithCustomProperty(customPropertyName, customPropertyValue, stringMatchOptionEnum, resultCollectionSize, trimUnavailable); return(result == null ? null : new TermCollectionInstance(this.Engine.Object.InstancePrototype, result)); }
public static void SearchTermsByCustomProperty(SPSite site, string customPropertyName) { TaxonomySession session = new TaxonomySession(site); // Search all Terms that contain a custom property with the provided name // from all TermStores associated with the provided site. TermCollection terms = session.GetTermsWithCustomProperty( customPropertyName, true); // The results should not contain unavailable Terms Console.WriteLine("The number of matching Terms is " + terms.Count); }