How to define a modern calendar view as default view

As seen in the previous article SharePoint and Microsoft Lists now have a modern calendar view that can be applied to any list.

While trying to define the calendar as a default view I’ve found two blocker issues and end up with a broken calendar not showing any information, thankfully PowerShell can always be used in situations like this when the interface does not fulfill the expectations.

Default calendar view

Modern calendar default view – The Problem

Microsoft Lists and SharePoint lists allow you to modify the default view through the user interface directly in the browser, however when you define the Calendar view as the default one you will be presented with the following error.

The number of items to display must be between 1 and 2147483647.

Calendar view error

After fixing this error and defining the number of items to display it is possible to save the view as the default one, however this leads to another problem as shown in the following image.

Invalid Calendar view. Fix the following errors to continue.

Calendar view error

No matter how many times you try to save it, the error will not disappear. At this stage the only solution is delete the view and start from scratch.

Modern calendar default view – The Solution

To define your Calendar view as default view for your list you must use PnP PowerShell, if you don’t have it yet, download it from here. Once installed do the following:

  1. Open the PowerShell console on your computer
  2. Execute the following script
    Write-Host "Type the site collection URL:"
    $siteCollectionURL = Read-Host
    
    Write-Host "Type the list name:"
    $ListName = Read-Host
    
    Write-Host "Type the view name:"
    $ViewName = Read-Host
    
    Connect-PnPOnline -url $siteCollectionURL
    
    Set-PnPView -List $ListName -Identity $ViewName -Values @{DefaultView=$True}
  3. Provide the details
    • Site collection URL where the list is located
    • List name
    • View name
  4. Authenticate using your credentials
  5. Navigate to the list and you will see that your calendar view is now defied by default

Default calendar view


2 Responses to “How to define a modern calendar view as default view”

  1. Nite Dan

    January 18, 2021

    How to make calendar overlay in ” modern calendar ” ?

    Reply

Leave a Reply to João Ferreira


I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.