PnP powershell equivant - Hide content type from new menu

New Contributor

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

foreach ($ct in $l.ContentTypes)
    if ($ct.Name -eq 'ContentTypeName1')






2 Replies

Hi Rod,


you first need to add the new contenttype then change all items to the new contenttype end remove the contenttype.


thought i had some code but could not find it right now.






You can do that with the following code:

$contentTypeNamesInOrder = "Sub Project"
$contentTypes = $projectInformationList.ContentTypes

$ctList = New-Object System.Collections.Generic.List[Microsoft.SharePoint.Client.ContentTypeId]
Foreach($ct in $contentTypeNamesInOrder){
$ctToInclude = $contentTypes | Where-Object {$_.Name -eq $ct}
#Updating content type order and visibility
$projectInformationList.RootFolder.UniqueContentTypeOrder = $ctList