Example #1
0
        public ActionResult SetCDN(bool value)
        {
            bool CDNEnabled = false;

            try
            {
                using (var clientContext = GetClientContext())
                {
                    var tenant = new Office365Tenant(clientContext);

                    tenant.SetTenantCdnEnabled(SPOTenantCdnType.Public, value);

                    var publicCDNEnabled = tenant.GetTenantCdnEnabled(SPOTenantCdnType.Public);

                    clientContext.ExecuteQuery();

                    CDNEnabled = publicCDNEnabled.Value;

                    return(Json(CDNEnabled));
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                return(Json(ex.Message));
            }
        }