Darren Parkinson
Sep 26, 2017Brass Contributor
Can't turn off "Visible on New Button" for Content Type using PnP PowerShell
Hi,
I'm having trouble turning off the "Visible on New Button" option for a Content Type on a Document Library. I'm trying to use the "UniqueContentTypeOrder" to do that.
So far, it's not taking -- any thoughts? Snippet of script below.
Many thanks.
$doclib = Get-PnPList -Identity "Quotes" -Includes RootFolder.UniqueContentTypeOrder $lct = $doclib.ContentTypes $ctx.Load($lct) $ctx.ExecuteQuery() $rootFolder = $doclib.RootFolder $lucto = $doclib.ContentTypes | ?{$_.Name -ne "<Content Type I'm Trying to Hide>"} $list = New-Object 'System.Collections.Generic.List[Microsoft.SharePoint.Client.ContentTypeId]' foreach ($i in $lucto) { $id = $i.Id $list.Add($id) } $rootFolder.UniqueContentTypeOrder = $list $rootFolder.Update() $doclib.Update()