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

            ExportTermsHelper export = new ExportTermsHelper(ctx);
            XmlDocument       xml    = null;

            switch (ParameterSetName)
            {
            case "Tenant":
                xml = export.Export();
                break;

            case "TermStore":
                xml = export.Export(TermStore.Read());
                break;

            case "Group":
                xml = export.Export(Group.Read());
                break;

            case "TermSet":
                xml = export.Export(TermSet.Read());
                break;

            case "Term":
                xml = export.Export(Term.Read());
                break;
            }
            if (xml == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(OutputFile))
            {
                xml.Save(OutputFile);
            }
            else
            {
                WriteObject(xml);
            }
        }
예제 #2
0
        protected override void InternalProcessRecord()
        {
            ExportTerms export = new ExportTerms();
            XmlDocument xml    = null;

            switch (ParameterSetName)
            {
            case "TaxonomySession":
                xml = export.Export(TaxonomySession.Read());
                break;

            case "TermStore":
                xml = export.Export(TermStore.Read());
                break;

            case "Group":
                xml = export.Export(Group.Read());
                break;

            case "TermSet":
                xml = export.Export(TermSet.Read());
                break;

            case "Term":
                xml = export.Export(Term.Read());
                break;
            }
            if (xml == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(OutputFile))
            {
                xml.Save(OutputFile);
            }
            else
            {
                WriteResult(xml);
            }
        }