PnP-PowerShell icon indicating copy to clipboard operation
PnP-PowerShell copied to clipboard

Add-PnPField needs -AddToAllContentTypes parameter

Open sparkitect opened this issue 5 years ago • 3 comments

Reporting an Issue or Missing Feature

When adding a column to a List or Library using the browser, one has an option to add the column to all of the Content Types in the List or Library. When adding a column to a List or Library using PnP PowerShell, this option is missing. Annotation 2020-02-24 192810

Expected behavior

If a parameter (e.g. -AddToAllContentTypes) specifies that the column should be added to all List Content Types, then the column should indeed be added to all List Content Types.

Actual behavior

No such parameter exists and the column is only added to the List's Default Content Type.

Steps to reproduce behavior

  1. Create a List or Library
  2. Allow Content Types
  3. Add two or more Content Types to the List or Library
  4. Add a new column to the List or Library using the Add-PnPField cmdlet Add-PnPField -List $list -DisplayName $columnName -InternalName $columnInternalName -AddToDefaultView -Type $columnType | Out-Null
  5. Notice that the new column is only added to the Default Content Type

Which version of the PnP-PowerShell Cmdlets are you using?

  • [ ] PnP PowerShell for SharePoint 2013
  • [ ] PnP PowerShell for SharePoint 2016
  • [X] PnP PowerShell for SharePoint Online

What is the version of the Cmdlet module you are running?

3.18.2002.0

How did you install the PnP-PowerShell Cmdlets?

  • [ ] MSI Installed downloaded from GitHub
  • [X] Installed through the PowerShell Gallery with Install-Module
  • [ ] Other means

sparkitect avatar Feb 25 '20 03:02 sparkitect

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar Feb 25 '20 03:02 ghost

I opened a pull request to PnP-Sites-Core and another to PnP-PowerShell to implement -AddToAllContentTypes

jackpoz avatar Sep 12 '20 14:09 jackpoz

The PR has been merged and now you can use -AddToAllContentTypes parameter with Add-PnPField

jackpoz avatar Dec 08 '20 17:12 jackpoz