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)); }
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"); }
public PnPContext CreateSiteCollection(CommonSiteOptions siteToCreate, SiteCreationOptions creationOptions = null) { return(CreateSiteCollectionAsync(siteToCreate, creationOptions).GetAwaiter().GetResult()); }