SharePoint Online: Add Calendar Item using PowerShell

Requirement: Add Calendar event in SharePoint Online using PowerShell.

PowerShell to Add calendar event in sharepoint online

PowerShell to Add New Item in SharePoint Online Calendar

PowerShell is a powerful scripting language that can automate many tasks in SharePoint Online. Let’s add events to the SharePoint Online calendar using PowerShell:

#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"

$SiteURL = ""
$CalendarName = "Team Calendar"

Try {
    #Setup 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)

    #Get the Calendar list
    $CalendarList = $Ctx.web.lists.GetByTitle($CalendarName)

    #Add Calendar Item
    $ListCreationInfo = New-object Microsoft.SharePoint.Client.ListItemCreationInformation
    $ListItem = $CalendarList.AddItem($ListCreationInfo)
    $ListItem.ParseAndSetFieldValue("Title", "Townhall Meeting")
    $ListItem.ParseAndSetFieldValue("Description", "Global Townhall Meetings - Yearly schedule")
    $ListItem.ParseAndSetFieldValue("Location", "Ballroom")
    $ListItem.ParseAndSetFieldValue("EventDate", "01/01/2019 09:00 AM")
    $ListItem.ParseAndSetFieldValue("EndDate", "01/01/2019 06:00 PM")
    Write-host "Calendar Event Added Successfully!" -f Green
Catch {
    write-host -f Red "Error Adding Calendar Item!" $_.Exception.Message

To Set “All Day Event”, set flag “fAllDayEvent” = $true;

PnP PowerShell to Add Calendar Event in SharePoint Online

PowerShell can be a great option if you are looking for a way to add events to your SharePoint online calendar quickly! Here is the PnP PowerShell version to add an entry to a Calendar:

$SiteURL = ""
$CalendarName = "Team Calendar"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Add Event to Calendar
Add-PnPListItem -List $CalendarName -Values @{"Title" = "Team Meeting"; "Description"= "Monthly Team Meeting"; "Location"= "Ballroom"; "EventDate" = [datetime]"01/01/2019 8AM"; "EndDate"=[datetime]"01/01/2019 6PM";}

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “SharePoint Online: Add Calendar Item using PowerShell

  • Hello!

    I am trying to retrieve all meetings from the calendar and it shows me the wrong time (2 hours off) while web version shows the right time. Any ideas?


    • That is because, SharePoint stores Date-Time values in UTC format, and it applies the site’s timezone on top of it to adjust and display when you view it in the browser.


Leave a Reply

Your email address will not be published. Required fields are marked *