Add-PSSnapin -Name Microsoft.Sharepoint.Powershell
#$SiteURL = get-SPSite "http://srvr1:123/sites/ENGG/"
$w = get-spweb "http://sRVR1:123/sites/ENGG/"
$web = get-spweb "http://sRVR1:123/sites/ENGG/"
try
{
$cts = $w.ContentTypes
Write-Host "inside content types try block"
$spId = new-object Microsoft.SharePoint.SPContentTypeId("0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900DCED8380ADA44ABB8411D56976A5F491")
$spId
$ct = new-object Microsoft.SharePoint.SPContentType($spId,$cts,"BIFPageCT")
}
catch
{
Write-Host "error occured in creation"
}
Write-Host "going2 update web"
$w.Update();
#get all the ctypes from site collec
ForEach($ctype in $w.ContentTypes)
{ #write-host $ctype.Name": "$ctype.ID
if($ctype.Name -eq "BIFPageCT")
{ write-host $ctype.Name": "$ctype.ID }else { Write-Host "ctype not found" }}
I tried to create a new content type in my new site collec in my portal. but it failed to create.i have taken the content type id from my another site collc. where this content type is successfully created!
please help why i am getting content type not found error.