Example #1
0
        public ActionResult AddOrigin(string folderUrl)
        {
            try
            {
                IList <string> publicCdnOrigins = new List <string>();

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

                    tenant.AddTenantCdnOrigin(SPOTenantCdnType.Public, folderUrl);

                    publicCdnOrigins = tenant.GetTenantCdnOrigins(SPOTenantCdnType.Public);

                    clientContext.ExecuteQuery();
                }

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