Exemplo n.º 1
0
        public async Task <PnPContext> CreateSiteCollectionAsync(CommonSiteOptions siteToCreate, SiteCreationOptions creationOptions = null)
        {
            if (siteToCreate == null)
            {
                throw new ArgumentNullException(nameof(siteToCreate));
            }

            return(await SiteCollectionCreator.CreateSiteCollectionAsync(context, siteToCreate, creationOptions).ConfigureAwait(false));
        }
Exemplo n.º 2
0
        internal static async Task <PnPContext> CreateSiteCollectionAsync(PnPContext context, CommonSiteOptions siteToCreate, SiteCreationOptions creationOptions)
        {
            // Provide default creation options as input
            creationOptions = await EnsureSiteCreationOptionsAsync(context, creationOptions).ConfigureAwait(false);

            if (siteToCreate is ClassicSiteOptions classicSite)
            {
                return(await CreateClassicSiteAsync(context, classicSite, creationOptions).ConfigureAwait(false));
            }
            else if (siteToCreate is TeamSiteOptions teamSite)
            {
                return(await CreateTeamSiteAsync(context, teamSite, creationOptions).ConfigureAwait(false));
            }
            else if (siteToCreate is CommonNoGroupSiteOptions noGroupSite)
            {
                return(await CreateCommonNoGroupSiteAsync(context, noGroupSite, creationOptions).ConfigureAwait(false));
            }

            throw new ArgumentException("Provided site options are not implemented");
        }
Exemplo n.º 3
0
 public PnPContext CreateSiteCollection(CommonSiteOptions siteToCreate, SiteCreationOptions creationOptions = null)
 {
     return(CreateSiteCollectionAsync(siteToCreate, creationOptions).GetAwaiter().GetResult());
 }