Hello SharePointers,
Today in this article we will learn about how to create a SharePoint site using PowerShell, So let’s start. I hope you enjoyed our last post and learned How to move/copy files between libraries using Powershell.

Requirement:

Create a SharePoint communication site and Team sites using PowerShell.

How to create a Communication site in SharePoint online?

SharePoint online has a recent addition in its Space and that is Communication Site! The modern SharePoint communication site templates are designed to leverage information to a broader audience such as an entire organization or teams to keep them informed as well as engaged. you can share reports, images, news, documents, events and other information that communicates key information into a central place.

Communication sites provide the configurable template for the sites and pages to make your work easy while communicating a message to a larger audience. when you create a communication site in SharePoint, you can start with a blank site or choose one of the available templates, each one of them comes with default web parts to help users to get started faster.

Create a new communication 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.
How to create a Communication site in SharePoint online
Step 1.
  • Fill the site properties like “site name” which will automatically become a URL of the site. Though you can edit a URL if needed. The communication sites are always been created under the /sites/ managed path by default.
  • Choose any template from available 3 Templates. The topic is selected by default.
PnP PowerShell to create a Communication site in SharePoint online
Step 2
  • Change the language of the site if you wish to, English is by default.
  • Additionally, you can give a description by adding some text which lets people know the purpose of your site under “Advanced Settings” and then click on “Finish“.

As soon as you click on finish SharePoint creates your site so quickly and will appear in sites list. Now, we can customize our information. When ready, you can share it with other people by adding the permissions snd sharing with others. communication sites don’t come with office 365 group.

Communication site using PowerShell in SharePoint online
Result

You can also create a site from “SharePoint Home” (https://yourtenat.sharepoint.com/_layouts/15/sharepoint.aspx), you can view this page simply by going to office 365 app launcher, click SharePoint.

Create Communication site in SharePoint Online using PowerShell
Create a Sharepoint site from the Home page

Below are the areas where the communication site template suites well.

  • a typical Intranet, Extranet, and department sites.
  • Product or service-oriented sites, new portals.
  • campaigns, insights, events, business highlights and reviews

OK, Enough the explanation and let us create a communication site in SharePoint Online with PowerShell.

Create a SharePoint online communication site with PowerShell.

Using SPO Service

#Declare Parameters
$AdminCenterUrl = "https://spforfun-admin.sharepoint.com"
$SiteUrl = "https://Spfordun.sharepoint.com/sites/SharePointgems"
$SiteTitle = "SharePoint Gems"
$siteOwner = "[email protected]"

#Connect SharePoint Online
Connect-SPOService -Url $AdminCenterUrl -credentials (Get-Credential)

#Poershell to create new communication site
New-SPOSite -Url $SiteUrl -Owner $SiteOwner -Template "SITEPUBLISHING#0"  -Title $SiteTitle -StorageQuota 1048

Let’s move ahead and add some error-handling code in this and re-write the script in PnP PowerShell.

Create a Communication site in SharePoint online using PnP PowerShell

Here is a code for How to create a communication site using PnP PowerShell in SharePoint Online.

New-PnpSite -Type CommunicationSite -Title SharePointGems -Url "https://spforfun.sharepoint.com/sites/SharePointGems" -SiteDesign Topic 

Full Lines of code goes here:

#Declare all variables
$AdminCenterUrl = "https://spforfun-admin.sharepoint.com"
$SiteUrl = "https://Spfordun.sharepoint.com/sites/SharePointgems"
$SiteTitle = "SharePoint Gems"
$siteOwner = "[email protected]"
$Template = "SITEPUBLISHING#0"  #COMMUNICATION SITE TEMPLATE

#Get Credentials to connecct
$cred = Get-Credentials
Try
{
  #connect Admin site
  Connect-PnPOnline -Url $AdminCenterUrl -Credentials $Cred
  
  #Check if site exist
  $site = Get-PnPTenantSite | Where {$_.Url -eq $SiteUrl}
  
  If ($Site -eq $null)
  {
    #SharePoint Online PnP Powershell to create communication site
    Create-PnpTenantSite -Url $SiteUrl -Owner $siteOwner -Title $SiteTitle -Tempalte $Template
   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
}

In this way, we can create a Communication site in SharePoint Online using Powershell.

See more tutorials of SharePointgems

know more about new-pnpsite here and SharePoint Diary.

6 thoughts on “Create a Communication Site using PowerShell”
  1. I am the business owner of JustCBD Store label (justcbdstore.com) and am planning to develop my wholesale side of company. I am hoping someone at targetdomain is able to provide some guidance . I considered that the most suitable way to do this would be to reach out to vape companies and cbd stores. I was hoping if anybody at all could recommend a dependable website where I can purchase Vape Shop B2B Data I am already looking at creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. On the fence which one would be the most suitable selection and would appreciate any advice on this. Or would it be easier for me to scrape my own leads? Suggestions?

Leave a Reply