Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        protected SiteProfile GetSiteProfile(ClientContext ctx)
        {
            ISiteClassificationFactory _factory = SiteClassificationFactory.GetInstance();
            ISiteClassificationManager _manager = _factory.GetManager(ctx);
            var _siteProfile = _manager.GetSiteProfile(ctx);

            return(_siteProfile);
        }