I have a question regarding the creating a Document Library based on the custom list definition, how can I do that using the PowerShell.


3 Answers 3


In PowerShell you can add a library the same way as you would do in C# code

First you get the Web

$url =  "<url web>"
$web = Get-SPWeb $url

Then get the template name of a definition

To determine the name you can use someting like

$web.ListTemplates | Select Name, BaseType

Then take the name. The example below takes the document library definition and add a list based on that definition

$template = "Document Library"
$listTemplate = $web.ListTemplates[$Template]
$listurl = "<url list>"
$description = "<description>"

Try with the following code,

Add-PSSnapin Microsoft.Sharepoint.Powershell
Start-SPAssignment -Global
$SPWeb = Get-SPWeb -Identity $Web
$listTemplate = $SPWeb.ListTemplates[$Template]
$list = $SPWeb.Lists[$ListUrl] // ex: Lists["/pts/single/Pharma Docs"]
$list.Title = $ListTitle
$list.OnQuickLaunch = "True"
Stop-SPAssignment -Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell



Solved the issue with following code:

$workspace = $web.Webs[$workspaceURL]
$guid = $workspace.Lists.Add("CustomList", "", "CustomList", "632c2951-92c7-456e-b2e0-3034b80816be", "101", "101");

Add functions, you provide the name, description, another name, GUID of the feature deploying list definition, type, type

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.