Skip to content

Fix bug #5018 #5023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions documentation/Remove-PnPTermLabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Remove-PnPTermLabel
-Lcid <Int32>
[-TermStore <Guid>]
[-Connection <PnPConnection>]
[-Confirm]
[-Force]

```

Expand All @@ -36,7 +36,7 @@ Remove-PnPTermLabel
-TermGroup <Name|Guid>
[-TermStore <Guid>]
[-Connection <PnPConnection>]
[-Confirm]
[-Force]

```

Expand All @@ -60,13 +60,12 @@ Removes the Swedish label from the specified term.

## PARAMETERS

### -Confirm
Prompts you for confirmation before running the cmdlet.
### -Force
Specifying the Force parameter will skip the confirmation question.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Expand Down
5 changes: 4 additions & 1 deletion src/Commands/Taxonomy/RemoveTermLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class RemoveTermLabel : PnPSharePointCmdlet
[Parameter(Mandatory = false, ValueFromPipeline = true, ParameterSetName = ParameterAttribute.AllParameterSets)]
public TaxonomyTermStorePipeBind TermStore;

[Parameter(Mandatory = false)]
public SwitchParameter Force;

protected override void ExecuteCmdlet()
{
var taxonomySession = TaxonomySession.GetTaxonomySession(ClientContext);
Expand Down Expand Up @@ -67,7 +70,7 @@ protected override void ExecuteCmdlet()
if (term != null)
{
term.EnsureProperties(t => t.Name, t => t.Id);
if (ShouldContinue($"Delete label {Label} for language {Lcid} from Term {term.Name} with id {term.Id}", Properties.Resources.Confirm))
if (Force || ShouldContinue($"Delete label {Label} for language {Lcid} from Term {term.Name} with id {term.Id}", Properties.Resources.Confirm))
{
var labels = term.GetAllLabels(Lcid);
ClientContext.Load(labels);
Expand Down
Loading