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.
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.
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.
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:
- Open the PowerShell console on your computer
- 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}
- Provide the details
- Site collection URL where the list is located
- List name
- View name
- Authenticate using your credentials
- Navigate to the list and you will see that your calendar view is now defied by default
January 18, 2021
How to make calendar overlay in ” modern calendar ” ?
January 19, 2021
Hi Nite,
Not possible for now.
Have a nice day 🙂