Powershell script to create Link List in sharepoint

$addedSPSnapin = $false
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.SharePoint.PowerShell
$addedSPSnapin = $true
}

try

{
$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::Links
$spweb.Lists.Add(“ListName”,”Desc of the List”,$listTemplate)
write-host “List added in the Web : ” $spweb -foregroundcolor Green
$spweb.Dispose()
}
catch [System.SystemException]
{
write-host “Execution stopped due to: “+$_.Message -foregroundcolor Red
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami