Пример #1
0
        //[Alias("Locale", "Language")]
        //[Parameter(Mandatory = false,
        //    Position = 7,
        //    HelpMessage = "The language code identifier (LCID) of the Term.Labels to be matched.")]
        //public int LCID { get; set; }

        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            var ctx = base.Context;

            TaxonomySession ts = TaxonomySession.GetTaxonomySession(ctx);
            //if (LCID == 0)
            //    LCID = GetWorkingLanguage(ts);

            //LabelMatchInformation lmi = new LabelMatchInformation(ctx);
            //ctx.Load(lmi);
            //ctx.ExecuteQuery();
            //lmi.StringMatchOption = StringMatchOption;
            //lmi.DefaultLabelOnly = DefaultLabelOnly.ToBool();
            //lmi.ExcludeKeyword = ExcludeKeyword.ToBool();
            //lmi.TrimUnavailable = TrimUnavailable.ToBool();
            //lmi.TrimDeprecated = TrimDeprecated.ToBool();
            //lmi.ResultCollectionSize = ResultCollectionSize;
            //lmi.Lcid = LCID;
            //lmi.TermLabel = Identity;

            //var terms = ts.GetTerms(lmi);

            var terms = ts.GetTermsInDefaultLanguage(Identity, DefaultLabelOnly, StringMatchOption, ResultCollectionSize, TrimUnavailable, TrimDeprecated);

            ctx.Load(terms);
            ctx.ExecuteQuery();
            foreach (var term in terms)
            {
                WriteObject(new SPOTerm(term));
            }
        }
Пример #2
0
        public TermCollectionInstance GetTermsInDefaultLanguage(string termLabel, bool defaultLabelOnly,
                                                                string stringMatchOption, int resultCollectionSize, bool trimUnavailable, bool trimDeprecated)
        {
            var stringMatchOptionEnum = (StringMatchOption)Enum.Parse(typeof(StringMatchOption), stringMatchOption);

            var result = m_taxonomySession.GetTermsInDefaultLanguage(termLabel, defaultLabelOnly, stringMatchOptionEnum,
                                                                     resultCollectionSize, trimUnavailable, trimDeprecated);

            return(result == null
              ? null
              : new TermCollectionInstance(this.Engine.Object.InstancePrototype, result));
        }