How To Create Modern Sharepoint Site
Requirement: Create modern site collection SharePoint online PowerShell
SharePoint Online modern sites provide a whole new user experience by their 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:
Wait for a moment and your site collection should appear in the site collections list. BTW, You can create a new site collection from the SharePoint Online start page as well (https://<tenant>.sharepoint.com/_layouts/15/sharepoint.aspx). Now, let's see how to create a modern team site without a group in
SharePoint Online 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"
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 -IsPublic
Let'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
Salaudeen Rajack
Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!
How To Create Modern Sharepoint Site
Source: https://www.sharepointdiary.com/2019/07/create-modern-site-in-sharepoint-online-using-powershell.html
Posted by: smithaginsons.blogspot.com
0 Response to "How To Create Modern Sharepoint Site"
Post a Comment