private static async Task <PnPContext> CreateClassicSiteAsync(PnPContext context, ClassicSiteOptions siteToCreate, SiteCreationOptions creationOptions) { using (var tenantAdminContext = await context.GetSharePointAdmin().GetTenantAdminCenterContextAsync().ConfigureAwait(false)) { string owner = siteToCreate.Owner; var splitOwner = owner.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (splitOwner.Length == 3) { owner = splitOwner[2]; } List <IRequest <object> > csomRequests = new List <IRequest <object> > { new CreateSiteRequest(siteToCreate.Url, siteToCreate.Title, owner, siteToCreate.WebTemplate, (int)siteToCreate.Language, (int)siteToCreate.TimeZone) }; var result = await(tenantAdminContext.Web as Web).RawRequestAsync(new ApiCall(csomRequests), HttpMethod.Post).ConfigureAwait(false); SpoOperation op = result.ApiCall.CSOMRequests[0].Result as SpoOperation; if (!op.IsComplete) { await SiteCollectionManagement.WaitForSpoOperationCompleteAsync(tenantAdminContext, op).ConfigureAwait(false); } return(await context.CloneAsync(siteToCreate.Url).ConfigureAwait(false)); } }
public async Task RestoreSiteCollectionAsync(Uri siteToRestore) { if (siteToRestore == null) { throw new ArgumentNullException(nameof(siteToRestore)); } await SiteCollectionManagement.RestoreSiteCollectionAsync(context, siteToRestore).ConfigureAwait(false); }
public async Task <List <ISiteCollectionAdmin> > GetSiteCollectionAdminsAsync(Uri site) { if (site == null) { throw new ArgumentNullException(nameof(site)); } return(await SiteCollectionManagement.GetSiteCollectionAdminsAsync(context, site).ConfigureAwait(true)); }
public async Task SetSiteCollectionAdminsAsync(Uri site, List <string> sharePointAdminLoginNames = null, List <Guid> ownerGroupAzureAdUserIds = null) { if (site == null) { throw new ArgumentNullException(nameof(site)); } await SiteCollectionManagement.SetSiteCollectionAdminsAsync(context, site, sharePointAdminLoginNames, ownerGroupAzureAdUserIds).ConfigureAwait(false); }
public async Task <ISiteCollectionProperties> GetSiteCollectionPropertiesAsync(Uri site) { if (site == null) { throw new ArgumentNullException(nameof(site)); } return(await SiteCollectionManagement.GetSiteCollectionPropertiesByUrlAsync(context, site, true).ConfigureAwait(true)); }