Retrieve SharePoint online List Templates using PowerShell

List Templates in SPO
in this article I would like to discuss about artifacts Lists and Libraries. As we know that we have some variation between SharePoint on premise and SharePoint Online, it is always good to know what available list of templates in SharePoint Online are?
For ease of access, I have implemented the below PowerShell script which will display list of available templates in SharePoint Online. You can write and debug the PowerShell script in Windows PowerShell ISE or you can also write in Visual Studio code.



function get-SPOListTemplates
{
    #Variables that needs to be set before starting the script
    $strSiteURL = “<< Site URL >>”
    $strUsrName = “<< User Name >>”
    # Reading password for the user account
    $strPWD = Read-Host “Please enter the password for $($strUsrName)” -AsSecureString
    # set SharePoint Online credentials
    $SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($strUsrName, $strPWD)
    # Creating client context for the provided user name and password
    $objContext = New-Object Microsoft.SharePoint.Client.ClientContext($strSiteURL)
    $objContext.credentials = $SPOCredentials
    $LstTempColl = $objContext.web.listtemplates
    $objContext.load($LstTempColl)
    #Sending the request to pull all the list templates
    try{
        $objContext.executeQuery()
        write-host “The list of templates available in SPO:” -foregroundcolor white -backgroundcolor red
    }
    catch{
        write-host “info: $($_.Exception.Message)” -foregroundcolor red
    }
    #List templates available in SPO
    #$LstTempColl | select baseType, Description, ListTemplateTypeKind | ft -wrap # This will show the full description of the list template description
    $LstTempColl | select baseType, Description, ListTemplateTypeKind
}
get-SPOListTemplates
The output is as follows:
List Templates in SPO
List Templates in SPO

Now that we know list templates we can create list / library seamlessly!!! Hope this helps!!!


You May Also like the Following SharePoint Online Tutorials:

About Krishna Vandanapu

I am Krishna.Vandanapu a SharePoint architect working in IT from last 12 years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019

View all posts by Krishna Vandanapu →