In SharePoint Online, when creating a new list, also known as a Microsoft List, there are several templates to pick from, in order to save some time. In your company, if you have a specific template that you would like to create, to be used in any SharePoint site, there is a way to create a custom list template, using PowerShell, if you’re a SharePoint admin.
When you click to create a new list, if you do not see “From your organization” here, that means that this feature has not rolled out to your tenant yet.
First of all, you can at any time create a list from an existing list in SharePoint, without the need for a template, but if you would like to have your own organization’s templates listed on the From your organization tab, the easiest way to do that is to start with an existing list. Once you’ve determined which list that is, it’s time to crack open PowerShell.
1. Click the Start menu on your computer, and type ISE. Right click on Windows PowerShell ISE, and choose Run as Administrator.
2. Here are Microsoft’s official instructions on this process, and their link to Download the latest SharePoint Online Management Shell, which you’ll need now. You’ll need to be in the SharePoint Admin role in your tenant in order to be able to do the next step.
3. At the beginning of my script, I always run an “Update-Module” command, to make sure the SharePoint PowerShell on my computer is on the latest version. Here is the whole script, and I’ll explain it in the next steps. I don’t recommend copying and pasting this. Those numbers at the beginning of each line are not part of the code, I’m using them to explain each line here.
1 Update-Module Microsoft.Online.SharePoint.PowerShell
2 Connect-SPOService -Url “https://yourcompany-admin.sharepoint.com”
3 $extracted = Get-SPOSiteScriptFromList –ListUrl “https://yourcompany.sharepoint.com/sites/yoursite/Lists/YourList”
4 $listscript = Add-SPOSiteScript -Title “IW Mentor Company Store” -Description “This creates a company store list” -Content $extracted
5 Add-SPOListDesign -Title “IW Mentor Company Store” -Description “Keep track of departmental available supplies” -SiteScripts $listscript.Id -ListColor Blue -ListIcon BullseyeTarget –Thumbnail “https://yourcompany.sharepoint.com/sites/yoursite/SiteAssets/yourimage.jpg“
4. When connecting using the Connect-SPOService command in line 2, this is where you’ll use the name of your tenant, with a hyphen admin.sharepoint.com. Again, if you’re not a SharePoint admin in the tenant, this command won’t work.
5. In line 3, this is where you point it to where the current list is that you’d like to copy, to run Get-SPOSiteScriptFromList. This is the full URL to the list, and notice that I didn’t include anything after the name of the list, there’s no allitems.aspx. This line is getting the list and setting it in a variable.
6. Line 4 is using the list you just obtained, and running the Add-SPOSiteScript command on it. This is where you tell it what you want the title and description to be, but this is just the title and description of the site script, not the template that end users will see.
7. Line 5 is where your list template gets added to the list of “From your organization” templates. The title and description that you type here, will be what is listed when end users are looking at the templates to pick from your organization.
For the ListColor, here are the colors to choose from: DarkRed, Red, Orange, Green, DarkGreen, Teal, Blue, NavyBlue, BluePurple, DarkBlue, Lavendar, Pink
For the ListIcon, here are the icons to choose from:
That last part of the code, the Thumbnail, is where you tell it which image to use, to represent your list. You can see that in mine, it’s a picture of someone at a computer, and that picture is referred to in the spot of the code yourimage.jpg
When referring to an image, it should already be uploaded to SharePoint somewhere, and I recommend putting it in a library that everyone has access to, so that they will be able to see the image.
8. When you click on a template from the Create a list screen, this is the next screen. You can click through your organization templates down the left side, and get a preview of the columns that exist in them. Also, notice that for this first list, I used the color blue and the icon BullseyeTarget, and you can see those represented at the top next to the name of the template. Click Use Template on this screen, to create your new list from this template.
And that’s it!
When people use the template, there won’t be any data pre-populated in the list, it will always be empty. Also, there is an additional command called Grant-SPOSiteDesignRights, which is supposed to allow you to deem only a certain security group of people to be able to see that template.
We covered this and more, in this hour-long free video, demonstrating this whole process on our weekly Power Hour show:
Again, here is Microsoft’s full documentation: Creating custom list templates
Here is Microsoft’s official PowerShell documentation