Save list or library as template
Many times when you setup a document library (or a list) with lots of metadata columns, views, etc you want to save it as a template so that you can reuse that model on all other sites without having to do the same setup over and over. But if you go to the Settings of a modern site in SharePoint online you will not find a link to “Save list or library as template” anymore. As an on prem user, you are used to work like this, using templates to be able to setup a list or library quickly somewhere else and that will save you lots of work since you don’t have to recreate the same columns/views etc again. Here are two options to achieve this in SharePoint online:
Option 1: Using Powershell
To enable the “save as template” option you must run a Powershell command. I tried this and it works just fine: you will see the link in the library settings and if you go to “Add an app” your list template will show up as we are used to. Note: you must go to “add an app” because in modern views, if you click on “New” and “Document library” you will not see the list of templates.
When things like this are removed or hidden in SharePoint online, it is of course for a reason, but I cannot tell or judge if it’s a risk to enable this link using the PS command. Maybe someone who reads this knows? Then please leave a comment, it would be much appreciated! It has worked fine in my tenant and the libraries that I added using my template works exactly the same as any other modern library. But I can only say: run this at your own “risk” 🙂
The following cmdlet must be run on the site where the library is that you want to save as template, and then also on the other sites where you want to use the template. So you are not enabling the command on your entire tenant. Open SharePoint online management shell and run the following cmdlet:
1 $SiteURL = “https://tenantName.sharepoint.com/sites/yoursite”
2 Connect-SPOService -Url “https://tenantName-admin.sharepoint.com”
3 Set-SPOsite $SiteURL -DenyAddAndCustomizePages 0
Now when you go to a library (or list) settings you will see this link:
Option 2: Using Content Type Hub
The second option is to use the Content Type Hub. You will not achieve the exact same result as when using a template, but you will get the site columns at least. Go to the content type hub by adding “/sites/contenttypehub” after your tenant url. You cannot publish only the site columns (again: WHY? I cannot answer this either, but it’s not good) so you have to create a Content Type first. I added one called “Word template” and it will contain my site columns. As soon as you add this to your library, all columns are automatically added too. The steps are:
Create a new Content Type, select “Document Content Types” and “Document” as parent content type and add it to your own custom group (I recommend to add your own group and name it after the company or the area where it will be used because then it will be easier for the users to find the custom content types)
Then add the site columns on “Add from new site column”, configure it and then store it in a custom group (then you will be able to add any of these site columns from any site in your tenant).
When your columns are added, don’t forget to click on “Manage publishing for this content type” and click on “Publish”!! Otherwise nothing will be pushed out to your sites! And if you update this content type, you must click it again and select “Republish”. The publishing can take up to one hour.
When all this is done and published, you can go to the library where you want these columns. First you must enable the option “Allow management of content types” in advanced settings of the library, otherwise you will not be able to add your new own content types:
A new section “Content types” is added in the library settings. Click onb Add from existing site content types and select your own content type from the list. Now the columns are also added into the library and you can make them visible on the “All documents” view.
This is not exactly as what you get using a library template, but at least you are not modifying any backend settings and this is certainly a recommended solution. What you don’t get using this is any custom views, filters, etc but still a good alternative.