예제 #1
0
파일: SPHelper.cs 프로젝트: spdavid/SP2018
        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);
        }