pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
684 stars 351 forks source link

[BUG] The parameter 'IsDefault' on the cmdlet New-PnPTermLabel is not working properly #4515

Closed TRACKSENS closed 5 hours ago

TRACKSENS commented 3 weeks ago

Hello,

On the cmdlet New-PnPTermLabel, if the parameter 'IsDefault' is set, it should insert a default label (a name).

If the parameter 'IsDefault' is not present, it should insert a synonym.

Actual behavior

Currently the presence/absence of the parameter 'IsDefault' does no do anything. The new label is always inserted as default label, and the previous one is set as a 'synonym'.

Steps to reproduce behavior

This code should include a synonym on the term: New-PnPTermLabel -Name "City of Paris" -Lcid 1033 -Term myTermId

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

Module version : 2.12.0

Which operating system/environment are you running PnP PowerShell on?

schatti commented 5 days ago

I experience the exact same behavior. I think the bug is on Line 27 in src/Commands/Taxonomy/NewTermLabel.cs where the SwitchParameter "IsDefault" is set to true.

wilecoyotegenius commented 3 days ago

@TRACKSENS You may add a synonym by issuing a following command:

New-PnPTermLabel -Name "City of Paris" -Lcid 1033 -Term myTermId -IsDefault:$false

I would not call this as a bug. What I may propose is an update to the documentation (to clearly indicate that without explicit value new term label becomes a default one). Changing the code now to make IsDefault = false would be a breaking change for all scripts using this cmdlet.