예제 #1
0
        public TermCollectionInstance GetTerms(string termLabel, object arg2, object arg3)
        {
            TermCollection result;

            if (arg3 == Undefined.Value || arg3 == Null.Value || arg3 == null)
            {
                result = m_taxonomySession.GetTerms(termLabel, TypeConverter.ToBoolean(arg2));
            }
            else
            {
                result = m_taxonomySession.GetTerms(termLabel, TypeConverter.ToInteger(arg2), TypeConverter.ToBoolean(arg3));
            }

            return(result == null
              ? null
              : new TermCollectionInstance(this.Engine.Object.InstancePrototype, result));
        }
예제 #2
0
        public static void SearchTermsByLabel(SPSite site, string prefix)
        {
            TaxonomySession session = new TaxonomySession(site);

            // Search all Terms that start with the provide prefix from
            // all TermStores associated with the provided site.
            TermCollection terms = session.GetTerms(prefix,
                true, // Only search in default labels
                StringMatchOption.StartsWith,
                5,  // The maximum number of terms returned from each TermStore
                true); // The results should not contain unavailable terms

            Console.WriteLine("The number of matching Terms is " + terms.Count);
        }