Exemplo n.º 1
0
        public static void CreateTaxonomy(ClientContext ctx)
        {
            TermStore store = ctx.Site.GetDefaultSiteCollectionTermStore();

            TermGroup group = store.GetGroup("{0671B184-F909-4DCA-B383-6E05C969BEF1}".ToGuid());

            ctx.Load(group);
            ctx.ExecuteQuery();
            if (group.ServerObjectIsNull())
            {
                group = store.CreateTermGroup("David1", "{0671B184-F909-4DCA-B383-6E05C969BEF1}".ToGuid());
            }

            TermSet ts = group.EnsureTermSet("Color", "{19419441-6982-4978-8800-F12A46E6FE37}".ToGuid(), 1033);

            // Term term = ts.CreateTerm("Green", 1033, "{FA6628FA-9790-4622-9B54-23D103A67FCD}".ToGuid());
            // Term term2 = ts.CreateTerm("Röd", 1053, "{24FA5756-25E8-4257-A4E5-D53C3D48B595}".ToGuid());
            // ctx.ExecuteQuery();

            // term2.EnsureLabel(1033, "Red", false);

            Term term2 = ts.CreateTerm("Blue", 1033, "{73E90F88-BD96-4066-8237-2D0DAAE3F11C}".ToGuid());

            ctx.ExecuteQuery();

            term2.EnsureLabel(1053, "Blå", false);
        }
Exemplo n.º 2
0
        //gavdcodeend 16

        //gavdcodebegin 14
        static void SpCsPnpcoreCreateTermSetEnsure(ClientContext spCtx)
        {
            TermGroup myTermGroup = spCtx.Site.EnsureTermGroup("CsPnpcoreTermGroupEns");
            TermSet   myTermSet   = myTermGroup.EnsureTermSet("CsPnpcoreTermSetEns");

            Console.WriteLine(myTermSet.Id);
        }
Exemplo n.º 3
0
        public static void CreateTaxonomyFavColor(ClientContext ctx)
        {
            TermStore store = ctx.Site.GetDefaultSiteCollectionTermStore();

            TermGroup group = store.GetTermGroupByName("School");

            if (group == null)
            {
                group = store.CreateTermGroup("School", "{13E6924A-196D-4313-A1B4-3A21AF3958CF}".ToGuid(), "description");
            }
            TermSet termSet = group.EnsureTermSet("Fav Color", "{3D4C7DE0-3867-44C3-871A-C36DEC4E1970}".ToGuid(), 1033);


            Term term = store.GetTerm("{1BB08D14-4464-410C-A27C-BA2EB8EFE9DE}".ToGuid());

            ctx.Load(term);
            ctx.ExecuteQuery();

            if (term.ServerObjectIsNull())
            {
                termSet.CreateTerm("Green", 1033, "{1BB08D14-4464-410C-A27C-BA2EB8EFE9DE}".ToGuid());
                termSet.CreateTerm("Blue", 1033, "{E96EF7E0-7F9B-4F66-BA1A-C2DBCC73DD78}".ToGuid());
                termSet.CreateTerm("Red", 1033, "{13E22744-483D-49D2-B92D-6BD2E0C10D9C}".ToGuid());
                ctx.ExecuteQuery();
            }
        }
Exemplo n.º 4
0
        public static void CreateIssueCategoryTermSet(ClientContext ctx)
        {
            //TaxonomySession taxSession = TaxonomySession.GetTaxonomySession(ctx);
            //TermStore store = taxSession.TermStores[0];
            TermStore store = ctx.Site.GetDefaultSiteCollectionTermStore();

            TermGroup group = store.GetTermGroupByName("OD1Test");

            if (group == null)
            {
                group = store.CreateTermGroup("OD1Test", "{13E6924A-196D-4313-A1B4-3A21AF3958CF}".ToGuid(), "description");
            }
            TermSet termSet = group.EnsureTermSet("Issue Category", "{3D4C7DE0-3867-44C3-871A-C36DEC4E1970}".ToGuid(), 1033);


            Term term = store.GetTerm("{1BB08D14-4464-410C-A27C-BA2EB8EFE9DE}".ToGuid());

            ctx.Load(term);
            ctx.ExecuteQuery();

            if (term == null)
            {
                termSet.CreateTerm("Just Right", 1033, "{1BB08D14-4464-410C-A27C-BA2EB8EFE9DE}".ToGuid());
                termSet.CreateTerm("Low Priority", 1033, "{E96EF7E0-7F9B-4F66-BA1A-C2DBCC73DD78}".ToGuid());
                termSet.CreateTerm("Urgent", 1033, "{13E22744-483D-49D2-B92D-6BD2E0C10D9C}".ToGuid());

                ctx.ExecuteQuery();
            }
        }