Donnerstag, 26. Januar 2012

Powershell script how to create a list

You might want to create a list with Powershell. Here is some code you can use (Replace the values in % with your values):

[void][System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$siteUrl = %your site-url%
$site = new-object Microsoft.SharePoint.SPSite($siteUrl)
$web = $site.rootweb
$templateType = $web.ListTemplates["Custom List %or add another list-template%"]
$web.Lists.Add("%enter the list-name you want to use%", "%enter the description%", $templateType)
$web.Dispose()
$site.Dispose()

Keine Kommentare:

Kommentar veröffentlichen