Sunday, May 24, 2015

Create List from List Template in SharePoint using PowerShell

Requirement: Create a SharePoint list from List template using PowerShell

PowerShell script to create a SharePoint list from list template:
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue

Function Create-ListFromTemplate($WebURL, $ListName, $TemplateName)
    #Get the Web from URL
    $Web = Get-SPWeb $WebURL

    #Get the Specific list template
    $Template = $$Web) | where {$_.InternalName -match $TemplateName }

 #Check if given template name exists!
    if($Template -eq $null)
        Write-host "Specified list template not found!" -f Red

    #Create List instance from given list template
    $web.Lists.Add($ListName, $ListName, $Template)
    Write-host "List instance Created from List template" -f DarkGreen 


#Call the function to create list from template
Create-ListFromTemplate $WebURL $ListName $ListTemplateName

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...