
Microsoft Lists are everywhere! It is available now in preview with MSA account. Great way to organize your grocery trips, home projects or any personal lists. Check it out here. Moving on to the topic, Microsoft did a great job by providing pre-built templates. There are 8 of them available as of today. Any of them will be a good starting point if you are starting with Microsoft Lists. But there is more!
You can build your own custom Microsoft Lists templates for your organization. No matter how many pre-built templates Microsoft provides, there is always a need to setup your own org specific templates. Setting them up is simple if you are familiar with PowerShell.
If you have setup custom site themes or site designs by creating site scripts and adding it to the tenant, creating custom lists templates will be an easy task for you. Custom list templates are created following similar pattern of commands.
High level steps involved:
- Create a custom list with all your columns, views and json formatting.
- Extract site script from list and upload it.
- Create custom list template referencing site script uploaded in above step.
Here is how to do it:
If you don’t have it setup already, first thing is to download the latest SharePoint online management shell.
Connect to SharePoint Online as an SP admin or Global admin.
Step1: Create a custom list with all your customizations.
Once you have SP Online management shell setup and connected to your tenant, run the following PowerShell command to extract site script from your custom list.
$customlist = Get-SPOSiteScriptFromList -ListUrl "https://bharatharja.sharepoint.com/sites/Landing/projects"
Step2: Upload site script.
$ScirptID = Add-SPOSiteScript -Title "Project Details" -Description "This creates a Project details list" -Content $customlist
Step3: Create your custom list template using the script ID from Step 2.
Add-SPOListDesign -Title "Project Details tracker" -Description "Tracks Project data in a list" -SiteScripts "<ID from previous step>" -ListColor Green -ListIcon BullseyeTarget -Thumbnail "https://bharatharja.sharepoint.com/SiteAssets/site-thumbnail.png"
Custom list template created will be accessible for everyone in your org by default. It will be available under ‘My Organization’ tab.
If you want to restrict it only to a group of people reference this Microsoft article to restrict access to your custom list templates.
Update your existing list templates:
There is no option available to update your existing templates. Workaround is to delete and recreate them.
Get your List template ID by running following command. This will list all your list templates. Copy the ID you want to delete.
Get-SPOListDesign
Deleting custom list template is a 2 step process like creation.
- Delete list design.
- Delete site script.
Remove-SPOListDesign <List design ID>
Remove-SPOSiteScript <Site script ID>