Exemplo n.º 1
0
        public TermSetCollectionInstance GetTermSets(ArrayInstance termLabels, object lcid)
        {
            var termLabelsList = new List <string>();

            for (var i = 0; i < termLabels.Length; i++)
            {
                var label = termLabels[i] as string;
                if (label != null)
                {
                    termLabelsList.Add(label);
                }
            }

            TermSetCollectionInstance result = null;

            if (lcid == null || lcid == Null.Value || lcid == Undefined.Value)
            {
                var termSets = m_taxonomySession.GetTermSets(termLabelsList.ToArray());
                if (termSets != null)
                {
                    result = new TermSetCollectionInstance(this.Engine.Object.InstancePrototype, termSets);
                }
            }
            else
            {
                var termSets = m_taxonomySession.GetTermSets(termLabelsList.ToArray(), TypeConverter.ToInteger(lcid));

                if (termSets != null)
                {
                    result = new TermSetCollectionInstance(this.Engine.Object.InstancePrototype, termSets);
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public static void SearchTermSetsByTermLabels(SPSite site,
            string[] termLabels)
        {
            TaxonomySession session = new TaxonomySession(site);

            // Returns all TermSet instances from all TermStores that contain terms 
            // with matching labels for all specified strings.
            TermSetCollection termSets = session.GetTermSets(termLabels);
            Console.WriteLine("The number of matching Term Sets is " + termSets.Count);
        }
Exemplo n.º 3
0
        public static void SearchTermSetsByName(SPSite site,
            string termSetName)
        {
            TaxonomySession session = new TaxonomySession(site);

            // Search all TermSets that are using the provided name in current
            // UI LCID from all TermStores associated with the provided site.
            TermSetCollection termSets = session.GetTermSets(termSetName,
                CultureInfo.CurrentUICulture.LCID);

            Console.WriteLine("The number of matching Term Sets is " + termSets.Count);
        }