Add-PSSnapIn Microsoft.SharePoint.PowerShell
#Update : incomplete on 09-feb-2015 05 pm
$siteCollecURL = "http://sirvr11:123/sites/Engineering/WIP"
$basicContentType="Basic Content Type"
#$siteColl = Get-SPSite -Identity $siteCollecURL
$paramWeb = Get-SPWeb -Identity $siteCollecURL
Write-Host $siteColl.Url
$pdoclib ="CY"
$docLib = $paramWeb.Lists[$pdoclib]
$docLib.Title
if ($docLib -ne $null)
{
$docLib.ContentTypesEnabled = $true
$docLib.Update()
#Add site content types to the list
$ctToAdd = $paramWeb.ContentTypes["Basic Content Type"]
$ctToAdd.Name
pause
try
{
$ct = $docLib.ContentTypes.Add($ctToAdd)
}
catch
{
write-host "error adding Content type" $ct.Name "to" $docLib.Title
}
write-host "Content type" $ct.Name "added to list" $docLib.Title
$docLib.Update()
}
am trying to add the "BasicContent Type" to my doc lib called "CY" with the help of above power shells cript.
but it failed to add .
getting the error message.can anyone pls help where am missing any steps /line of code.
help is appreciated!