Create a Modern Site Collection in SharePoint Online using PowerShell
Requirement: Create modern site collection SharePoint online PowerShell
How to Create Modern Team Site in SharePoint Online?
SharePoint Online modern sites provide whole new user experience by its intuitive design, responsive UI optimized for mobile devices, and faster page loading. By default, when you create a site in the SharePoint Online admin center, it creates a modern team with an associated Office 365 group. How to create a modern site collection in SharePoint Online? Well, To create a modern SharePoint Online Site collection, follow these steps:
SharePoint Online: Create Modern Team Site Collection using PowerShell
You can create a modern site collection in SharePoint Online by specifying the site template as "STS#3".
Create Modern Site Collection in SharePoint Online using PowerShell
SharePoint modern team sites allow you to share information with your team in the organization. You can use a team site to store and collaborate on files and manage lists of information. To Create a modern team site using PowerShell in SharePoint Online:
PnP PowerShell to Create Modern Site
If you want to create a modern site collection with Office 365 group, use New-PnPSite cmdlet of PnP PowerShell in SharePoint Online.
How to Create Modern Team Site in SharePoint Online?
SharePoint Online modern sites provide whole new user experience by its intuitive design, responsive UI optimized for mobile devices, and faster page loading. By default, when you create a site in the SharePoint Online admin center, it creates a modern team with an associated Office 365 group. How to create a modern site collection in SharePoint Online? Well, To create a modern SharePoint Online Site collection, follow these steps:
- Login to New SharePoint Admin Center as a tenant admin or SharePoint Online Administrator.
- Click on Sites >> Active Sites from left navigation >> Click on "Create"
- Click on "Team site" to create a modern team site in SharePoint Online.
- Provide the site Name, URL, Group owner options and click on "Finish" to create a modern site collection in SharePoint Online.
- To set Privacy settings, and language you can expand "Advance Settings" and set site's privacy whether its a private site or public site accessible to everyone in the organization. Then, click the Next button.
SharePoint Online: Create Modern Team Site Collection using PowerShell
You can create a modern site collection in SharePoint Online by specifying the site template as "STS#3".
#Connect to SharePoint Online Connect-SPOService -url "https://crescent-admin.sharepoint.com" -Credential (Get-credential) #Create a modern team site New-SPOSite -Url "https://crescent.sharepoint.com/sites/Purchase" -Owner "[email protected]" -StorageQuota 2048 -Title "Purchase Team Site" -Template "STS#3"
Create Modern Site Collection in SharePoint Online using PowerShell
SharePoint modern team sites allow you to share information with your team in the organization. You can use a team site to store and collaborate on files and manage lists of information. To Create a modern team site using PowerShell in SharePoint Online:
#PowerShell to create modern site collection Function Create-SPOSite { param ( [string]$Title = $(throw "Please Provide the Site Title!"), [string]$URL = $(throw "Please Provide the Site URL!"), [string]$Owner = $(throw "Please Provide the Site Owner!"), [int]$StorageQuota = $(throw "Please Provide the Site Storage Quota!") ) #Connection parameters $AdminURL = "https://crescent-admin.sharepoint.com" $AdminName = "[email protected]" Try{ #Connect to Office 365 Connect-SPOService -Url $AdminURL -Credential (Get-Credential) #Check if the site collection exists already $SiteExists = Get-SPOSite | Where {$_.URL -eq $URL} #Check if the site exists in the recycle bin $SiteExistsInRecycleBin = Get-SPODeletedSite | where {$_.url -eq $URL} If($SiteExists -ne $null) { write-host "Site $($url) exists already!" -foregroundcolor Yellow } elseIf($SiteExistsInRecycleBin -ne $null) { write-host "Site $($url) exists in the recycle bin!" -foregroundcolor Yellow } else { #sharepoint online create modern site collection powershell New-SPOSite -Url $URL -title $Title -Owner $Owner -StorageQuota $StorageQuota -NoWait -ResourceQuota $ResourceQuota -Template $Template write-host "Site Collection $($url) Created Successfully!" -foregroundcolor Green } } catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red } } #Parameters to create new site collection $SiteTitle = "Purchase" $SiteURL= "https://crescent.sharepoint.com/sites/purchase" $SiteOwner = "[email protected]" $StorageQuota = 2048 $SiteTemplate = "STS#3" #Call The function to create site collection Create-SPOSite -Title $SiteTitle -URL $SiteURL -Owner $SiteOwner -StorageQuota $StorageQuota -Template $SiteTemplate
PnP PowerShell to Create Modern Site
If you want to create a modern site collection with Office 365 group, use New-PnPSite cmdlet of PnP PowerShell in SharePoint Online.
New-PnPSite -Type TeamSite -Title Test Modern TeamSite -Alias TestModernTeamSite -IsPublicLet's wrap it inside a function and add some error handling to PnP PowerShell script to create a modern site:
#Define Variables $AdminCenterURL = "https://crescent-Admin.sharepoint.com" $SiteURL = "https://crescent.sharepoint.com/sites/procurement2" $SiteTitle = "crescent Procurement Portal" $SiteOwner = "[email protected]" $Template = "STS#3" #Modern Team Site $Timezone = 24 #GMT+4 #Get Credentials to connect $Cred = Get-Credential Try { #Connect to Tenant Admin Connect-PnPOnline -URL $AdminCenterURL -Credential $Cred #Check if site exists already $Site = Get-PnPTenantSite | Where {$_.Url -eq $SiteURL} If ($Site -eq $null) { #sharepoint online pnp powershell create site collection New-PnPTenantSite -Url $SiteURL -Owner $SiteOwner -Title $SiteTitle -Template $Template -TimeZone $TimeZone -RemoveDeletedSite write-host "Site Collection $($SiteURL) Created Successfully!" -foregroundcolor Green } else { write-host "Site $($SiteURL) exists already!" -foregroundcolor Yellow } } Catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red }How to create a modern site without group? SharePoint Online: Create Modern Team Site without Group
No comments:
Please Login and comment to get your questions answered!