コード例 #1
0
        protected void btnUploadTermSet_Click(object sender, EventArgs e)
        {
            // Update Term set drop down for the taxonomy field creation.
            var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(ctx);
                TermStore       termStore       = taxonomySession.GetDefaultSiteCollectionTermStore();
                TermGroup       group           = termStore.GetGroup(new Guid(drpGroups.SelectedValue));

                group.ImportTermSet(Server.MapPath("~/Resources/ImportTermSet.csv"),
                                    termSetId: SampleTermSetId, synchroniseDeletions: true);
            }
            // Update term setup drop down
            UpdateTermSetsBasedOnSelectedGroup(drpGroups.SelectedValue);
        }