Created
May 8, 2019 06:49
-
-
Save OlafD/3358b42bf3bb20281b7d137386836a81 to your computer and use it in GitHub Desktop.
Add a field to the (sealed) content type "Folder" in a library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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