Friday, October 28, 2011

Create SPList through Powershell

Leave a Comment
Scenario : Create List in SharePoint through PowerShell


Execute following script in PowerShell


PS > $site = Get-SPSite("SPSiteUrl")
PS > $web = $site.OpenWeb()
PS > $listcollection = $web.Lists
PS > $template = [Microsoft.SharePoint.SPListTemplateType]::GenericList
PS > $newid = $listcollection.Add("MYList","MyList Description",$template);
PS > $newlist = $web.Lists["MYList"];
PS > $newlist.OnQuickLaunch = "True"
PS > $newlist.Update();

0 comments: