Skip to content

Instantly share code, notes, and snippets.

@OlafD
Created May 8, 2019 06:49
Show Gist options
  • Save OlafD/3358b42bf3bb20281b7d137386836a81 to your computer and use it in GitHub Desktop.
Save OlafD/3358b42bf3bb20281b7d137386836a81 to your computer and use it in GitHub Desktop.
Add a field to the (sealed) content type "Folder" in a library.
# 1) unseal the content type for folders in the library
$ct = Get-PnPContentType -Identity "Folder" -List "Documents"
$ct.Sealed = $false
$ct.Update($false) # using $true in this case will throw an execption
Invoke-PnPQuery
# 2) add the description field (must already exist) to the Folder content type
$ct = Get-PnPContentType -Identity "Folder" -List "Documents"
$field = Get-PnPField -List "Documents" -Identity "Description"
$flci = New-Object Microsoft.SharePoint.Client.FieldLinkCreationInformation
$flci.Field =$field
$ct.FieldLinks.Add($flci)
$ct.Update($false)
Invoke-PnPQuery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment