pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
989 stars 662 forks source link

Add-PnPField needs -AddToAllContentTypes parameter #2535

Open sparkitect opened 4 years ago

sparkitect commented 4 years ago

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?

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

3.18.2002.0

How did you install the PnP-PowerShell Cmdlets?

ghost commented 4 years ago

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

jackpoz commented 4 years ago

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

jackpoz commented 3 years ago

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