How to Create a Calendar List in Modern SharePoint Online Site?
Requirement: Create a calendar list in SharePoint Online.
How to create a calendar in SharePoint Online?
SharePoint Online calendar list provides a convenient and visual way to organize meetings and events. You can display calendar lists in daily, weekly, and monthly views. Adding a calendar to a SharePoint Online modern site is a bit tricky, as it’s moved under “Classic Apps”. To create a calendar list in SharePoint Online, follow these steps:
- Login to your SharePoint Online modern site >> Click on the “New” toolbar >> Choose “App”.
- On the SharePoint Apps page, click on the “Classic Experience” link. This will take you to the classic apps page. (URL shortcut: https://YourDomain.sharepoint.com/sites/Your-Site/_layouts/15/addanapp.aspx).
- Scroll down (or search) and pick the “Calendar” app.
- Enter the name for your calendar and click on “Create”.
Now, you have a calendar list created on the SharePoint Online modern site.
SharePoint Online: PowerShell to Create a Calendar
Let’s create a calendar in SharePoint Online using PnP PowerShell:
#Parameters
$SiteURL = "https://crescent.sharepoint.com"
$CalendarName = "Firm Events"
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Get the File
$Calenar = New-PnPList -Title $CalendarName -Template Events -ErrorAction Stop
Write-host "Calendar List Added to the Site!" -f Green
}
Catch {
write-host -f Red "`tError:" $_.Exception.Message
}
Create Calendar List in SharePoint Online using PowerShell CSOM
Here is the CSOM way to add a new calendar list in SharePoint Online:
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Parameters
$SiteURL = "https://Crescent.sharepoint.com/sites/Events"
$CalendarName = "Firm Events"
Try {
#Get Credentials to connect
$Cred = Get-Credential
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
#Create a Calendar
$ListInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$ListInfo.Title = $CalendarName
$ListInfo.TemplateType = 106
$List = $Ctx.web.Lists.Add($ListInfo)
$List.Description = $ListTitle
$List.Update()
$Ctx.ExecuteQuery()
Write-host "Calendar List Added to the Site!" -f Green
}
Catch {
write-host -f Red "`tError:" $_.Exception.Message
}
So there’s no way to add a calendar without using PowerShell?
Of course, You can use the Web Browser UI method, as explained above!