예제 #1
0
파일: Index.aspx.cs 프로젝트: yangecnu/PnP
        protected void Submit_Click(object sender, EventArgs e)
        {
            var _spContext = SharePointContextProvider.Current.GetSharePointContext(Context);

            SiteProfile _profile = new SiteProfile();

            _profile.SitePolicy = this.GetSiteClassification();

            Dictionary <string, string> _customProps = new Dictionary <string, string>();

            _customProps.Add(SiteClassificationKeys.AudienceReachKey, this.GetAudience());
            _customProps.Add(SiteClassificationKeys.BusinessImpactKey, _profile.SitePolicy);

            _profile.CustomProperties = _customProps;

            using (var _ctx = _spContext.CreateUserClientContextForSPHost())
            {
                ISiteClassificationFactory _factory = SiteClassificationFactory.GetInstance();
                ISiteClassificationManager _manager = _factory.GetManager(_ctx);
                _manager.SaveSiteProperties(_ctx, _profile);
                AddJsLink(_ctx, _ctx.Web);
            }



            Response.Redirect(this.Url.Value);
        }
예제 #2
0
파일: Index.aspx.cs 프로젝트: yangecnu/PnP
        protected SiteProfile GetSiteProfile(ClientContext ctx)
        {
            ISiteClassificationFactory _factory = SiteClassificationFactory.GetInstance();
            ISiteClassificationManager _manager = _factory.GetManager(ctx);
            var _siteProfile = _manager.GetSiteProfile(ctx);

            return(_siteProfile);
        }