Rod Le Quesne
Jan 10, 2017Copper Contributor
PnP powershell equivant - Hide content type from new menu
Is there a method to hide content type from the 'new' menu on a list in the same way using the UI located at _layouts/15/ChangeContentTypeOrder.aspx. I have tried using following script, issue here is that it total hides the content type in the edit form :-(
$l = Get-PnPList -Identity "lists/MyList"-Web $web
$ctx = Get-pnpContext
$ctx.Load($l.ContentTypes)
$ctx.ExecuteQuery()
foreach ($ct in $l.ContentTypes)
{
$ct.Name
if ($ct.Name -eq 'ContentTypeName1')
{
$ct.Hidden=$true
$ct.Update($false)
}
}
$ctx.ExecuteQuery()
Regards...