예제 #1
0
        public bool ProvisionSiteCollection(Contract.SharePointProvisioningData sharePointProvisioningData)
        {
            bool processed = false;
            try
            {
                SiteProvisioningBase siteToProvision = null;
                switch (sharePointProvisioningData.Template)
                {
                    case SiteProvisioningTypes.ContosoCollaboration:
                        siteToProvision = new ContosoCollaboration();
                        break;
                    case SiteProvisioningTypes.ContosoProject:
                        siteToProvision = new ContosoProject();
                        break;
                }

                siteToProvision.SharePointProvisioningData = sharePointProvisioningData;
                HookupAuthentication(siteToProvision);

                // Hookup class that will hold the on-prem overrides
                SiteProvisioningOnPremises spo = new SiteProvisioningOnPremises();
                siteToProvision.SiteProvisioningOnPremises = spo;

                // Provision the site collection
                processed = siteToProvision.Execute();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //log error
            }

            return processed;
        }
        public bool ProvisionSiteCollection(Contract.SharePointProvisioningData sharePointProvisioningData)
        {
            bool processed = false;

            try
            {
                SiteProvisioningBase siteToProvision = null;
                switch (sharePointProvisioningData.Template)
                {
                case SiteProvisioningTypes.ContosoCollaboration:
                    siteToProvision = new ContosoCollaboration();
                    break;

                case SiteProvisioningTypes.ContosoProject:
                    siteToProvision = new ContosoProject();
                    break;
                }

                siteToProvision.SharePointProvisioningData = sharePointProvisioningData;
                HookupAuthentication(siteToProvision);

                // Hookup class that will hold the on-prem overrides
                SiteProvisioningOnPremises spo = new SiteProvisioningOnPremises();
                siteToProvision.SiteProvisioningOnPremises = spo;

                // Provision the site collection
                processed = siteToProvision.Execute();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //log error
            }

            return(processed);
        }