From 61dad6049d4d6a6661aba0183bd93812f9f89f60 Mon Sep 17 00:00:00 2001 From: "kunj.sangani" Date: Sun, 9 Apr 2023 00:09:16 +0530 Subject: [PATCH 1/2] Adding Move-PnPTerm and Move-PnPTermSet commands --- documentation/Move-PnPTerm.md | 177 +++++++++++++++++++++++++++ documentation/Move-PnPTermSet.md | 107 ++++++++++++++++ src/Commands/Taxonomy/MoveTerm.cs | 95 ++++++++++++++ src/Commands/Taxonomy/MoveTermSet.cs | 54 ++++++++ 4 files changed, 433 insertions(+) create mode 100644 documentation/Move-PnPTerm.md create mode 100644 documentation/Move-PnPTermSet.md create mode 100644 src/Commands/Taxonomy/MoveTerm.cs create mode 100644 src/Commands/Taxonomy/MoveTermSet.cs diff --git a/documentation/Move-PnPTerm.md b/documentation/Move-PnPTerm.md new file mode 100644 index 000000000..7d173f60b --- /dev/null +++ b/documentation/Move-PnPTerm.md @@ -0,0 +1,177 @@ +--- +Module Name: PnP.PowerShell +title: Move-PnPTerm +schema: 2.0.0 +applicable: SharePoint Online +external help file: PnP.PowerShell.dll-Help.xml +online version: https://pnp.github.io/powershell/cmdlets/Move-PnPTerm.html +--- + +# Move-PnPTerm + +## SYNOPSIS + +Moves a taxonomy term to another term set or term + +## SYNTAX + +### Move to term set by Term Id +``` +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTermSet 95e13729-3ccf-4ec8-998c-78e9ef1daa0b -DestinationTermGroup b2645144-5757-4cd7-b7f9-e5d24757addf +``` +### Move to term set by Term Name +``` +Move-PnPTerm -Identity "Test" -DestinationTermSet "TestTermSet1" -SourceTermSet "OperationLevel-1 Test" -SourceTermGroup "FromPowerAutomate" -DestinationTermGroup "TestingGroup" +``` +### Move to term +``` +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTerm 2ad90b20-b5c0-4544-ac64-25e32d51fa3b -MoveToTerm +``` + +## DESCRIPTION + +This cmdlet moves a taxonomy term to another term set or term + +## EXAMPLES + +### Example 1 +```powershell +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTermSet 95e13729-3ccf-4ec8-998c-78e9ef1daa0b -DestinationTermGroup b2645144-5757-4cd7-b7f9-e5d24757addf +``` + +Moves term by id to term set. + +### Example 2 +```powershell +Move-PnPTerm -Identity "Test" -DestinationTermSet "TestTermSet1" -SourceTermSet "OperationLevel-1 Test" -SourceTermGroup "FromPowerAutomate" -DestinationTermGroup "TestingGroup" +``` + +Moves term by name to term set. + +### Example 3 +```powershell +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTerm 2ad90b20-b5c0-4544-ac64-25e32d51fa3b -MoveToTerm +``` + +Moves a term to another term by its identifier. + +## PARAMETERS + +### -Identity +The identifier of the term that needs to be moved, either in the form of its name or its GUID + +```yaml +Type: TaxonomyTermPipeBind +Parameter Sets: (All) +Aliases: Term + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DestinationTermSet +The identifier of the term set where the term needs to be moved, either in the form of its name or its GUID + +```yaml +Type: TaxonomyTermSetPipeBind +Parameter Sets: By Term Id, By Term Name +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DestinationTermGroup +The identifier of the term group where the term needs to be moved, either in the form of its name or its GUID + +```yaml +Type: TaxonomyTermGroupPipeBind +Parameter Sets: By Term Id, By Term Name +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SourceTermSet +The identifier of the term set where the term is present, in the form of its name + +```yaml +Type: TaxonomyTermSetPipeBind +Parameter Sets: By Term Name +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SourceTermGroup +The identifier of the term set where the term group is present, in the form of its name + +```yaml +Type: TaxonomyTermGroupPipeBind +Parameter Sets: By Term Name +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DestinationTerm +The identifier of the term where the term needs to be moved, in the form of its GUID + +```yaml +Type: TaxonomyTermPipeBind +Parameter Sets: Move To Term +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -MoveToTerm +To be provided if the term needs to be moved to another term + +```yaml +Type: SwitchParameter +Parameter Sets: Move To Term + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TermStore +Term store to use; if not specified the default term store is used. + +```yaml +Type: TaxonomyTermStorePipeBind +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` \ No newline at end of file diff --git a/documentation/Move-PnPTermSet.md b/documentation/Move-PnPTermSet.md new file mode 100644 index 000000000..bbba5da29 --- /dev/null +++ b/documentation/Move-PnPTermSet.md @@ -0,0 +1,107 @@ +--- +Module Name: PnP.PowerShell +title: Move-PnPTermSet +schema: 2.0.0 +applicable: SharePoint Online +external help file: PnP.PowerShell.dll-Help.xml +online version: https://pnp.github.io/powershell/cmdlets/Move-PnPTermSet.html +--- + +# Move-PnPTermSet + +## SYNOPSIS + +Moves taxonomy term set from one term group to another + +## SYNTAX + +### By Term Id +``` +Move-PnPTermSet -Identity -SourceTermGroup -DestinationTermGroup [-TermStore ] +``` + +### By Term Name +``` +Move-PnPTermSet -Identity -SourceTermGroup -DestinationTermGroup [-TermStore ] +``` + +## DESCRIPTION +This cmdlet moves taxonomy term set from one term group to another. + +## EXAMPLES + +### Example 1 +```powershell +Move-PnPTermSet -Identity 81e0a4b8-701d-459c-ad61-a1c7a81810ff -SourceTermGroup 17e16b98-a8c2-4db6-a860-5c42dbc818f4 -DestinationTermGroup cf33d1cd-42d8-431c-9e43-3d8dab9ea8fd +``` + +Moves term set by id. + +### Example 2 +```powershell +Move-PnPTermSet -Identity "OperationLevel-1 Test" -SourceTermGroup "FromPowerAutomate" -DestinationTermGroup "DestinationTermGroup" +``` + +Moves term set by name. + +## PARAMETERS + +### -Identity +The identifier of the term set that needs to be moved, either in the form of its name or its GUID + +```yaml +Type: TaxonomyTermSetPipeBind +Parameter Sets: (All) +Aliases: TermSet + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -SourceTermGroup +The identifier, either in the form of the term group's name or its GUID, where the term set is currently located before being moved. + +```yaml +Type: TaxonomyTermGroupPipeBind +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -DestinationTermGroup +The identifier, either in the form of the term group's name or its GUID, indicating the destination where the term set should be relocated. + +```yaml +Type: TaxonomyTermGroupPipeBind +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -TermStore +Term store to use; if not specified the default term store is used. + +```yaml +Type: TaxonomyTermStorePipeBind +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` \ No newline at end of file diff --git a/src/Commands/Taxonomy/MoveTerm.cs b/src/Commands/Taxonomy/MoveTerm.cs new file mode 100644 index 000000000..f6a02b9cf --- /dev/null +++ b/src/Commands/Taxonomy/MoveTerm.cs @@ -0,0 +1,95 @@ +using Microsoft.SharePoint.Client; +using Microsoft.SharePoint.Client.Taxonomy; +using PnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace PnP.PowerShell.Commands.Taxonomy +{ + [Cmdlet(VerbsCommon.Move, "PnPTerm")] + public class MoveTerm : PnPSharePointCmdlet + { + private const string ParameterSet_TERMID = "By Term Id"; + private const string ParameterSet_TERMNAME = "By Term Name"; + private const string ParameterSet_MoveToTerm = "Move To Term"; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_MoveToTerm)] + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMID)] + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] + [Alias("Term")] + public TaxonomyTermPipeBind Identity; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMID)] + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] + public TaxonomyTermSetPipeBind DestinationTermSet; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMID)] + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] + public TaxonomyTermGroupPipeBind DestinationTermGroup; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] + public TaxonomyTermSetPipeBind SourceTermSet; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] + public TaxonomyTermGroupPipeBind SourceTermGroup; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_MoveToTerm)] + public TaxonomyTermPipeBind DestinationTerm; + + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_MoveToTerm)] + public SwitchParameter MoveToTerm; + + [Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets)] + [Alias("TermStoreName")] + public TaxonomyTermStorePipeBind TermStore; + + protected override void ExecuteCmdlet() + { + var taxonomySession = TaxonomySession.GetTaxonomySession(ClientContext); + // Get Term Store + TermStore termStore = null; + if (TermStore == null) + { + termStore = taxonomySession.GetDefaultSiteCollectionTermStore(); + } + else + { + termStore = TermStore.GetTermStore(taxonomySession); + } + if (MoveToTerm.ToBool()) + { + Term sourceterm = Identity.GetTerm(ClientContext, termStore, null, false, null); + Term destinationterm = DestinationTerm.GetTerm(ClientContext, termStore, null, false, null); + + sourceterm.Move(destinationterm); + ClientContext.ExecuteQueryRetry(); + } + else + { + Term term = null; + TermSet destinationtermSet = null; + if (ParameterSetName == ParameterSet_TERMID) + { + term = Identity.GetTerm(ClientContext, termStore, null, false, null); + TermGroup destinationtermGroup = DestinationTermGroup.GetGroup(termStore); + destinationtermSet = DestinationTermSet.GetTermSet(destinationtermGroup); + } + else + { + TermGroup termGroup = SourceTermGroup.GetGroup(termStore); + TermSet termSet = SourceTermSet.GetTermSet(termGroup); + term = Identity.GetTerm(ClientContext, termStore, termSet, false, null); + TermGroup destinationtermGroup = DestinationTermGroup.GetGroup(termStore); + destinationtermSet = DestinationTermSet.GetTermSet(destinationtermGroup); + } + + term.Move(destinationtermSet); + ClientContext.ExecuteQueryRetry(); + } + } + } +} diff --git a/src/Commands/Taxonomy/MoveTermSet.cs b/src/Commands/Taxonomy/MoveTermSet.cs new file mode 100644 index 000000000..4f0933910 --- /dev/null +++ b/src/Commands/Taxonomy/MoveTermSet.cs @@ -0,0 +1,54 @@ +using Microsoft.SharePoint.Client; +using Microsoft.SharePoint.Client.Taxonomy; +using PnP.PowerShell.Commands.Base.PipeBinds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace PnP.PowerShell.Commands.Taxonomy +{ + [Cmdlet(VerbsCommon.Move, "PnPTermSet")] + public class MoveTermSet : PnPSharePointCmdlet + { + + [Parameter(Mandatory = true, ValueFromPipeline = true)] + [Alias("TermSet")] + public TaxonomyTermSetPipeBind Identity; + + [Parameter(Mandatory = true, ValueFromPipeline = true)] + public TaxonomyTermGroupPipeBind SourceTermGroup; + + [Parameter(Mandatory = true, ValueFromPipeline = true)] + public TaxonomyTermGroupPipeBind DestinationTermGroup; + + [Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets)] + [Alias("TermStoreName")] + public TaxonomyTermStorePipeBind TermStore; + + protected override void ExecuteCmdlet() + { + var taxonomySession = TaxonomySession.GetTaxonomySession(ClientContext); + // Get Term Store + TermStore termStore = null; + if (TermStore == null) + { + termStore = taxonomySession.GetDefaultSiteCollectionTermStore(); + } + else + { + termStore = TermStore.GetTermStore(taxonomySession); + } + + TermGroup destinationtermGroup = DestinationTermGroup.GetGroup(termStore); + TermGroup sourcetermGroup = SourceTermGroup.GetGroup(termStore); + + TermSet termSet = Identity.GetTermSet(sourcetermGroup); + + termSet.Move(destinationtermGroup); + ClientContext.ExecuteQueryRetry(); + } + } +} From a3405882ade9b2375405dc2e715105d0a77dadec Mon Sep 17 00:00:00 2001 From: "kunj.sangani" Date: Sun, 14 May 2023 10:03:32 +0530 Subject: [PATCH 2/2] Changed the name of the parameters --- documentation/Move-PnPTerm.md | 22 +++++++++++----------- documentation/Move-PnPTermSet.md | 12 ++++++------ src/Commands/Taxonomy/MoveTerm.cs | 24 ++++++++++++------------ src/Commands/Taxonomy/MoveTermSet.cs | 8 ++++---- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/documentation/Move-PnPTerm.md b/documentation/Move-PnPTerm.md index 7d173f60b..f442fab12 100644 --- a/documentation/Move-PnPTerm.md +++ b/documentation/Move-PnPTerm.md @@ -17,15 +17,15 @@ Moves a taxonomy term to another term set or term ### Move to term set by Term Id ``` -Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTermSet 95e13729-3ccf-4ec8-998c-78e9ef1daa0b -DestinationTermGroup b2645144-5757-4cd7-b7f9-e5d24757addf +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -TargetTermSet 95e13729-3ccf-4ec8-998c-78e9ef1daa0b -TargetTermGroup b2645144-5757-4cd7-b7f9-e5d24757addf ``` ### Move to term set by Term Name ``` -Move-PnPTerm -Identity "Test" -DestinationTermSet "TestTermSet1" -SourceTermSet "OperationLevel-1 Test" -SourceTermGroup "FromPowerAutomate" -DestinationTermGroup "TestingGroup" +Move-PnPTerm -Identity "Test" -TargetTermSet "TestTermSet1" -TermSet "OperationLevel-1 Test" -TermGroup "FromPowerAutomate" -TargetTermGroup "TestingGroup" ``` ### Move to term ``` -Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTerm 2ad90b20-b5c0-4544-ac64-25e32d51fa3b -MoveToTerm +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -TargetTerm 2ad90b20-b5c0-4544-ac64-25e32d51fa3b -MoveToTerm ``` ## DESCRIPTION @@ -36,21 +36,21 @@ This cmdlet moves a taxonomy term to another term set or term ### Example 1 ```powershell -Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTermSet 95e13729-3ccf-4ec8-998c-78e9ef1daa0b -DestinationTermGroup b2645144-5757-4cd7-b7f9-e5d24757addf +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -TargetTermSet 95e13729-3ccf-4ec8-998c-78e9ef1daa0b -TargetTermGroup b2645144-5757-4cd7-b7f9-e5d24757addf ``` Moves term by id to term set. ### Example 2 ```powershell -Move-PnPTerm -Identity "Test" -DestinationTermSet "TestTermSet1" -SourceTermSet "OperationLevel-1 Test" -SourceTermGroup "FromPowerAutomate" -DestinationTermGroup "TestingGroup" +Move-PnPTerm -Identity "Test" -TargetTermSet "TestTermSet1" -TermSet "OperationLevel-1 Test" -TermGroup "FromPowerAutomate" -TargetTermGroup "TestingGroup" ``` Moves term by name to term set. ### Example 3 ```powershell -Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -DestinationTerm 2ad90b20-b5c0-4544-ac64-25e32d51fa3b -MoveToTerm +Move-PnPTerm -Identity d67966b0-3b60-4331-8dc4-0b5a2ca730fc -TargetTerm 2ad90b20-b5c0-4544-ac64-25e32d51fa3b -MoveToTerm ``` Moves a term to another term by its identifier. @@ -72,7 +72,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -DestinationTermSet +### -TargetTermSet The identifier of the term set where the term needs to be moved, either in the form of its name or its GUID ```yaml @@ -87,7 +87,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -DestinationTermGroup +### -TargetTermGroup The identifier of the term group where the term needs to be moved, either in the form of its name or its GUID ```yaml @@ -102,7 +102,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -SourceTermSet +### -TermSet The identifier of the term set where the term is present, in the form of its name ```yaml @@ -117,7 +117,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -SourceTermGroup +### -TermGroup The identifier of the term set where the term group is present, in the form of its name ```yaml @@ -132,7 +132,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -DestinationTerm +### -TargetTerm The identifier of the term where the term needs to be moved, in the form of its GUID ```yaml diff --git a/documentation/Move-PnPTermSet.md b/documentation/Move-PnPTermSet.md index bbba5da29..1cb3a4ea3 100644 --- a/documentation/Move-PnPTermSet.md +++ b/documentation/Move-PnPTermSet.md @@ -17,12 +17,12 @@ Moves taxonomy term set from one term group to another ### By Term Id ``` -Move-PnPTermSet -Identity -SourceTermGroup -DestinationTermGroup [-TermStore ] +Move-PnPTermSet -Identity -TermGroup -TargetTermGroup [-TermStore ] ``` ### By Term Name ``` -Move-PnPTermSet -Identity -SourceTermGroup -DestinationTermGroup [-TermStore ] +Move-PnPTermSet -Identity -TermGroup -TargetTermGroup [-TermStore ] ``` ## DESCRIPTION @@ -32,14 +32,14 @@ This cmdlet moves taxonomy term set from one term group to another. ### Example 1 ```powershell -Move-PnPTermSet -Identity 81e0a4b8-701d-459c-ad61-a1c7a81810ff -SourceTermGroup 17e16b98-a8c2-4db6-a860-5c42dbc818f4 -DestinationTermGroup cf33d1cd-42d8-431c-9e43-3d8dab9ea8fd +Move-PnPTermSet -Identity 81e0a4b8-701d-459c-ad61-a1c7a81810ff -TermGroup 17e16b98-a8c2-4db6-a860-5c42dbc818f4 -TargetTermGroup cf33d1cd-42d8-431c-9e43-3d8dab9ea8fd ``` Moves term set by id. ### Example 2 ```powershell -Move-PnPTermSet -Identity "OperationLevel-1 Test" -SourceTermGroup "FromPowerAutomate" -DestinationTermGroup "DestinationTermGroup" +Move-PnPTermSet -Identity "OperationLevel-1 Test" -TermGroup "FromPowerAutomate" -TargetTermGroup "TargetTermGroup" ``` Moves term set by name. @@ -61,7 +61,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -SourceTermGroup +### -TermGroup The identifier, either in the form of the term group's name or its GUID, where the term set is currently located before being moved. ```yaml @@ -76,7 +76,7 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` -### -DestinationTermGroup +### -TargetTermGroup The identifier, either in the form of the term group's name or its GUID, indicating the destination where the term set should be relocated. ```yaml diff --git a/src/Commands/Taxonomy/MoveTerm.cs b/src/Commands/Taxonomy/MoveTerm.cs index f6a02b9cf..996eeb3f1 100644 --- a/src/Commands/Taxonomy/MoveTerm.cs +++ b/src/Commands/Taxonomy/MoveTerm.cs @@ -25,20 +25,20 @@ public class MoveTerm : PnPSharePointCmdlet [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMID)] [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] - public TaxonomyTermSetPipeBind DestinationTermSet; + public TaxonomyTermSetPipeBind TargetTermSet; [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMID)] [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] - public TaxonomyTermGroupPipeBind DestinationTermGroup; + public TaxonomyTermGroupPipeBind TargetTermGroup; [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] - public TaxonomyTermSetPipeBind SourceTermSet; + public TaxonomyTermSetPipeBind TermSet; [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_TERMNAME)] - public TaxonomyTermGroupPipeBind SourceTermGroup; + public TaxonomyTermGroupPipeBind TermGroup; [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_MoveToTerm)] - public TaxonomyTermPipeBind DestinationTerm; + public TaxonomyTermPipeBind TargetTerm; [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet_MoveToTerm)] public SwitchParameter MoveToTerm; @@ -63,7 +63,7 @@ protected override void ExecuteCmdlet() if (MoveToTerm.ToBool()) { Term sourceterm = Identity.GetTerm(ClientContext, termStore, null, false, null); - Term destinationterm = DestinationTerm.GetTerm(ClientContext, termStore, null, false, null); + Term destinationterm = TargetTerm.GetTerm(ClientContext, termStore, null, false, null); sourceterm.Move(destinationterm); ClientContext.ExecuteQueryRetry(); @@ -75,16 +75,16 @@ protected override void ExecuteCmdlet() if (ParameterSetName == ParameterSet_TERMID) { term = Identity.GetTerm(ClientContext, termStore, null, false, null); - TermGroup destinationtermGroup = DestinationTermGroup.GetGroup(termStore); - destinationtermSet = DestinationTermSet.GetTermSet(destinationtermGroup); + TermGroup destinationtermGroup = TargetTermGroup.GetGroup(termStore); + destinationtermSet = TargetTermSet.GetTermSet(destinationtermGroup); } else { - TermGroup termGroup = SourceTermGroup.GetGroup(termStore); - TermSet termSet = SourceTermSet.GetTermSet(termGroup); + TermGroup termGroup = TermGroup.GetGroup(termStore); + TermSet termSet = TermSet.GetTermSet(termGroup); term = Identity.GetTerm(ClientContext, termStore, termSet, false, null); - TermGroup destinationtermGroup = DestinationTermGroup.GetGroup(termStore); - destinationtermSet = DestinationTermSet.GetTermSet(destinationtermGroup); + TermGroup destinationtermGroup = TargetTermGroup.GetGroup(termStore); + destinationtermSet = TargetTermSet.GetTermSet(destinationtermGroup); } term.Move(destinationtermSet); diff --git a/src/Commands/Taxonomy/MoveTermSet.cs b/src/Commands/Taxonomy/MoveTermSet.cs index 4f0933910..ee2796365 100644 --- a/src/Commands/Taxonomy/MoveTermSet.cs +++ b/src/Commands/Taxonomy/MoveTermSet.cs @@ -19,10 +19,10 @@ public class MoveTermSet : PnPSharePointCmdlet public TaxonomyTermSetPipeBind Identity; [Parameter(Mandatory = true, ValueFromPipeline = true)] - public TaxonomyTermGroupPipeBind SourceTermGroup; + public TaxonomyTermGroupPipeBind TermGroup; [Parameter(Mandatory = true, ValueFromPipeline = true)] - public TaxonomyTermGroupPipeBind DestinationTermGroup; + public TaxonomyTermGroupPipeBind TargetTermGroup; [Parameter(Mandatory = false, ParameterSetName = ParameterAttribute.AllParameterSets)] [Alias("TermStoreName")] @@ -42,8 +42,8 @@ protected override void ExecuteCmdlet() termStore = TermStore.GetTermStore(taxonomySession); } - TermGroup destinationtermGroup = DestinationTermGroup.GetGroup(termStore); - TermGroup sourcetermGroup = SourceTermGroup.GetGroup(termStore); + TermGroup destinationtermGroup = TargetTermGroup.GetGroup(termStore); + TermGroup sourcetermGroup = TermGroup.GetGroup(termStore); TermSet termSet = Identity.GetTermSet(sourcetermGroup);