예제 #1
0
 /// <summary>
 /// Member to apply the Provisioning Tempalte to a site
 /// </summary>
 /// <param name="web"></param>
 /// <exception cref="ProvisioningTemplateException">An Exception that occurs when applying the template to a site</exception>
 public void ApplyProvisioningTemplate(ProvisioningTemplate provisioningTemplate, SiteInformation siteRequest)
 {
     try
     {
         this._siteprovisioningService.Authentication         = new AppOnlyAuthenticationSite();
         this._siteprovisioningService.Authentication.SiteUrl = siteRequest.Url;
         var _web = _siteprovisioningService.GetWebByUrl(siteRequest.Url);
         provisioningTemplate.Connector = this.GetProvisioningConnector();
         provisioningTemplate           = new TemplateConversion().HandleProvisioningTemplate(provisioningTemplate, siteRequest);
         _web.ApplyProvisioningTemplate(provisioningTemplate);
     }
     catch (Exception _ex)
     {
         var _message = string.Format("Error Occured when applying the template: {0}", _ex.Message);
         throw new ProvisioningTemplateException(_message, _ex);
     }
 }
예제 #2
0
        /// <summary>
        /// Member to apply the Provisioning Tempalte to a site
        /// </summary>
        /// <param name="web"></param>
        /// <exception cref="ProvisioningTemplateException">An Exception that occurs when applying the template to a site</exception>
        public void ApplyProvisioningTemplate(ProvisioningTemplate provisioningTemplate, SiteInformation siteRequest, Template template)
        {
            try
            {
                this._siteprovisioningService.Authentication         = new AppOnlyAuthenticationSite();
                this._siteprovisioningService.Authentication.SiteUrl = siteRequest.Url;
                var _web = _siteprovisioningService.GetWebByUrl(siteRequest.Url);
                provisioningTemplate.Connector = this.GetProvisioningConnector();
                provisioningTemplate           = new TemplateConversion().HandleProvisioningTemplate(provisioningTemplate, siteRequest, template);

                ProvisioningTemplateApplyingInformation _pta = new ProvisioningTemplateApplyingInformation();
                _pta.ProgressDelegate = (message, step, total) =>
                {
                    Log.Info("SiteProvisioningManager.ApplyProvisioningTemplate", "Applying Provisioning template - Step {0}/{1} : {2} ", step, total, message);
                };
                _web.ApplyProvisioningTemplate(provisioningTemplate);
            }
            catch (Exception _ex)
            {
                var _message = string.Format("Error Occured when applying the template: {0} to site: {1}", _ex.Message, siteRequest.Url);
                throw new ProvisioningTemplateException(_message, _ex);
            }
        }