Question

I'm using the code below to create document libraries, but I need to set the "Document template" value to "Web part page". I can list the document templates using $spWeb.DocTemplates - but how can I set the value using PowerShell?

$spWeb = Get-SPWeb -Identity <url>
$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::DocumentLibrary
$spWeb.Lists.Add("Listname","List description", $listTemplate)
Was it helpful?

Solution

Check out my answer here: Set the Document Template of a Document Library programmatically

I think you can easily convert code provided there to PowerShell (if not let me know). Also be sure to read additional info.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top