PowerShell to create Team Site in SharePoint Online
Posted on
Image: PowerShell to create Team Site in SharePoint Online
Hello SharePointers,
In today’s article, we will learn about How to create a Team Site in SharePoint Online with PowerShell. This is the second part of the article series about creating SharePoint sites. In the last part, we learned about how to create a communication site in SharePoint Online using PowerShell. If you newly joined this blog and want to learn about the creation of the Communication site in SharePoint Online, then please click on how to Create a Communication site in Share Point Online.
Create a Modern/Classic Team site in SharePoint Online using PowerShell.
What is the TEAM site in SharePoint?
As per Microsoft, A SharePoint Team site Connects you and your team to the content, information, and apps you rely on every day. For Example, A team site can be used to store and collaborate on files or to create and manage lists of information.
Types of Team site in SharePoint.
In SharePoint Online there are two types on Team site, and they are as below.
Classic Team Site
Modern Team Site
Classic Team Sites:
Classic Team sites are the team sites which are created based on STS#0 Template. This sites are NOT associated with Office 365 Groups. These type of sites have a User Interface same like as SharePoint 2013 sites. Please see image below.
Img: Classic Team site
Modern Team Site:
Modern Team sites are the Team sites which are associated with Office 365 Groups. The Modern Team sites are created with “GROUP#0” Template of SharePoint Online. The Modern Team sites have a modern pages user interface. Please see image below.
Image: team site in SharePoint Online
So Now we will see How to create Team Site n SharePoint online.
Create a Team site in SharePoint Online.
Please follow the below steps to create a new communication site in SharePoint Online.
Login to New SharePoint Admin center as tenant administrator or SharePoint Online Administrator.
Click on “Sites” >> “Active Sites” from the left navigation >> Click on “Create” from available options >> select “Communication site” to create a new communication site.
Fill the site properties like “site name” which will automatically become a URL of the site. The team sites are created under the /sites/ managed path by default, but you can change it to /Teams / if required.
If you notice in below screen, the feild “Group Email Address” is nothing but a Office 365 group mailbox id, Which is automatically taken as per the site name. This means SharePoint will automatically create an Office 365 group as per the site name.
Give the Site Description if required.
Set Privacy Settings and Site Language.
Create SharePoint Team Site
Click on Next and this will create your Modern Team site associated with Office 365 Group.
Here We go, Let’s see how our site looks.
Final “SharePointGems” Team Site
Ok, That’s, enough about the Manual Process and Let’s create Team site Using PnP PowerShell.
Create SharePoint Online Team site using PowerShell.
We can create Team site in Two ways, Using SharePoint Online Management Shell, and Patterns & Practices for PowerShell That means PnP PowerShell.
Using SharePoint Online Management Shell (SPO Service) [creates Classic Team Site]
This will create a new Modern Team site with Title “SharePoint Gems” and the URL ‘https://tenant.sharePoint.com/sites/sharepointgems’ OR ‘https://tenant.sharePoint.com/teams/sharepointgems’ based on the managed path configuration in the SharePoint Online Admin Portal.
Full Line of code goes here.
#Declare all variables
$AdminCenterUrl = "https://spforfun-admin.sharepoint.com"
$SiteUrl = "https://Spfordun.sharepoint.com/teams/SharePointgems"
$SiteTitle = "SharePoint Gems"
$siteAlias = "SharePointGems"
#Get Credentials to connecct
$cred = Get-Credentials
Try
{
#connect Admin site
Connect-PnPOnline -Url $AdminCenterUrl -Credentials $Cred
#Check if site exist
$site = Get-PnpSite| Where {$_.Url -eq $SiteUrl}
If ($Site -eq $null)
{
#SharePoint Online PnP Powershell to create communication site
New-PnPSite -Type "Team Site" -Title $SiteTitle -Alias $siteAlias
write-Host "Site Collection $SiteUrl created Successfully!" -f Green
}
else
{
write-Host "Site $SiteUrl already Exist!" -f Yellow
}
}
Catch
{
wirte-Host "Error Occurred $($_.Exception.Message)" -f Red
}
You can create multiple team sites by creating a “.csv” file of multiple URL and reading in PnP Powershell.
If we want to create the same then we need to add foreach loop in the above code.
And That’s it. Bingo !!! we have successfully created a Team site using both the methods of PowerShell.
Hello , i see the your website get very good daily traffic , why donot you make more money by joining >> https://cutt.ly/ads-wordpress , your daily earning will be increased alongside with adsence try it now for few days and see your daily earning >> https://cutt.ly/ads-wordpress
Guys Please send your feedback about this article here.
Oh my God, Thanks i Just Found what i have been looking for in Months here. You are better
Another script-copy!
Hello , i just want to share with you this money making method by using CPA ,learn more here >> https://warriorplus.com/o2/a/ps5v5/0
Hello , i see the your website get very good daily traffic , why donot you make more money by joining >> https://cutt.ly/ads-wordpress , your daily earning will be increased alongside with adsence try it now for few days and see your daily earning >> https://cutt.ly/ads-wordpress
I just came across website that can help you to get the best and top wordpress hosting >>https://www.best-wordpress-hostings.org/2/