How to Create a Custom Document Library Template for SharePoint
In this blog post, I’m showing you how to create a custom document library template for SharePoint using the existing PowerShell-based tooling for creating custom list templates. This feature is rolling out to Microsoft 365 customers in February and March 2024, and it will allow you to provide your users with more options and flexibility when creating document libraries in SharePoint.
What is a Document Library Template?
A document library template is a predefined set of settings, columns, views, and formatting that you can apply to a new document library. This can help you save time and ensure consistency across your document libraries. For example, you can create a document library template for project documents, invoices, contracts, or any other type of documents that you frequently use in your organization.
How to Create a Custom Document Library Template
To create a custom document library template, you will need to use the PowerShell cmdlets for SharePoint Online. You can find the documentation and examples of these cmdlets here.
The basic steps are as follows:
- Create a document library in SharePoint Online and configure it with the settings, columns, views, and formatting that you want to use for your template.
- Execute the following script to export the document library as a template and create the list template for your organization
Write-Host "Type URL to the document library to be used as a template:" $listURL = Read-Host $tenenatName = $listURL.Split(".")[0].Split("//")[2] Write-Host "Type a title for the template:" $templateName = Read-Host Write-Host "Type a description for the template:" $templateDescription = Read-Host Write-Host "Type the url to the the thumbnail to be used by the template" $templateThumbnail = Read-Host Connect-SPOService -url ("https://{0}-admin.sharepoint.com" -f $tenenatName) $listTemplate = Get-SPOSiteScriptFromList -ListUrl $listURL $siteScript = Add-SPOSiteScript -Title $templateName -Description $templateDescription -Content $listTemplate Add-SPOListDesign -Title $templateName -Description $templateDescription -SiteScripts $siteScript.Id -Thumbnail $templateThumbnail
- Provide the URL to the list that will be used as a template
- Provide the name and description for the list template
- Provide the URL to be used as a thumbnail for the list, it is recommended to host the URL in SharePoint prior the template creation in a location accessible to all the users in the organization
- Authenticate using your credentials and wait for the execution of the script to finish
The process takes only a few seconds and once completed your will see a message similar to what is displayed in the image above.
How to Create a New Document Library Based on a Custom Template
The creation of document libraries using your new template is super simple, all you have to do is:
- On any SharePoint site click on New and then Document Library
- Click in the From your organization tab
- Select your newly created template from the list of available templates
- Click Use template
- Provide a name and a description for your new document library
- Click Create and start using it
Conclusion
Creating custom document library templates for SharePoint is a great way to provide your users with more options and flexibility when creating document libraries. You can use the existing PowerShell-based tooling for creating custom list templates to create and manage your document library templates. This feature is rolling out to Microsoft 365 customers in February and March 2024, so stay tuned for more updates and enhancements.
No comments yet