Skip to content

Commit 5152b45

Browse files
committed
Added list name completer to list parameter
1 parent 3c90d7e commit 5152b45

20 files changed

+43
-4
lines changed

src/Commands/Lists/AddListItem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using PnP.PowerShell.Commands.Base.PipeBinds;
88
using PnP.PowerShell.Commands.Model;
99
using PnP.PowerShell.Commands.Utilities;
10+
using PnP.PowerShell.Commands.Base.Completers;
1011

1112
// IMPORTANT: If you make changes to this cmdlet, also make the similar/same changes to the Set-PnPListItem Cmdlet
1213

@@ -22,6 +23,7 @@ public class AddListItem : PnPWebCmdlet
2223
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_SINGLE)]
2324
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_BATCHED)]
2425
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
26+
[ArgumentCompleter(typeof(ListNameCompleter))]
2527
[ValidateNotNull]
2628
public ListPipeBind List;
2729

src/Commands/Lists/AddListItemAttachment.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using PnP.Core.Model.SharePoint;
2+
using PnP.PowerShell.Commands.Base.Completers;
23
using PnP.PowerShell.Commands.Base.PipeBinds;
34
using System;
45
using System.Collections.Generic;
@@ -19,6 +20,7 @@ public class AddListItemAttachment : PnPWebCmdlet
1920
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, ParameterSetName = ParameterSet_ASSTREAM)]
2021
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, ParameterSetName = ParameterSet_ASFILE)]
2122
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, ParameterSetName = ParameterSet_ASTEXT)]
23+
[ArgumentCompleter(typeof(ListNameCompleter))]
2224
public ListPipeBind List;
2325

2426
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 1, ParameterSetName = ParameterSet_ASSTREAM)]

src/Commands/Lists/AddView.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Management.Automation;
22
using Microsoft.SharePoint.Client;
3-
3+
using PnP.PowerShell.Commands.Base.Completers;
44
using PnP.PowerShell.Commands.Base.PipeBinds;
55

66
namespace PnP.PowerShell.Commands.Lists
@@ -10,6 +10,8 @@ namespace PnP.PowerShell.Commands.Lists
1010
public class AddView : PnPWebCmdlet
1111
{
1212
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
13+
[ArgumentCompleter(typeof(ListNameCompleter))]
14+
1315
public ListPipeBind List;
1416

1517
[Parameter(Mandatory = true)]
@@ -32,7 +34,7 @@ public class AddView : PnPWebCmdlet
3234

3335
[Parameter(Mandatory = false)]
3436
public SwitchParameter SetAsDefault;
35-
37+
3638
[Parameter(Mandatory = false)]
3739
public SwitchParameter Paged;
3840

@@ -46,7 +48,7 @@ protected override void ExecuteCmdlet()
4648
{
4749
var view = list.CreateView(Title, ViewType, Fields, RowLimit, SetAsDefault, Query, Personal, Paged);
4850

49-
if(ParameterSpecified(nameof(Aggregations)))
51+
if (ParameterSpecified(nameof(Aggregations)))
5052
{
5153
view.Aggregations = Aggregations;
5254
view.Update();

src/Commands/Lists/AddViewXML.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.SharePoint.Client;
2+
using PnP.PowerShell.Commands.Base.Completers;
23
using PnP.PowerShell.Commands.Base.PipeBinds;
34
using System;
45
using System.Collections.Generic;
@@ -12,6 +13,7 @@ namespace PnP.PowerShell.Commands.Lists
1213
public class AddViewXML : PnPWebCmdlet
1314
{
1415
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
16+
[ArgumentCompleter(typeof(ListNameCompleter))]
1517
public ListPipeBind List;
1618

1719
[Parameter(Mandatory = true)]

src/Commands/Lists/ClearDefaultColumnValues.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Management.Automation;
44
using Microsoft.SharePoint.Client;
55
using PnP.Framework.Entities;
6-
6+
using PnP.PowerShell.Commands.Base.Completers;
77
using PnP.PowerShell.Commands.Base.PipeBinds;
88

99
namespace PnP.PowerShell.Commands.Lists
@@ -15,6 +15,7 @@ namespace PnP.PowerShell.Commands.Lists
1515
public class ClearDefaultColumnValues : PnPWebCmdlet
1616
{
1717
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
18+
[ArgumentCompleter(typeof(ListNameCompleter))]
1819
public ListPipeBind List;
1920

2021
[Parameter(Mandatory = true)]

src/Commands/Lists/CopyList.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using PnP.PowerShell.Commands.Utilities.REST;
77
using PnP.PowerShell.Commands.Model.SharePoint;
88
using System.Text.Json.Nodes;
9+
using PnP.PowerShell.Commands.Base.Completers;
910

1011
namespace PnP.PowerShell.Commands.Lists
1112
{
@@ -26,6 +27,7 @@ public class CopyList : PnPWebCmdlet
2627

2728
[Parameter(ParameterSetName = ParameterSet_TOCURRENTSITEBYPIPE, Mandatory = true)]
2829
[Parameter(ParameterSetName = ParameterSet_LISTBYPIPE, Mandatory = true, ValueFromPipeline = true)]
30+
[ArgumentCompleter(typeof(ListNameCompleter))]
2931
public ListPipeBind Identity;
3032

3133
[Parameter(ParameterSetName = ParameterSet_TOCURRENTSITEBYURL, Mandatory = true)]

src/Commands/Lists/GetDefaultColumnValues.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using PnP.PowerShell.Commands.Base.PipeBinds;
99
using PnP.PowerShell.Commands.Model.SharePoint;
10+
using PnP.PowerShell.Commands.Base.Completers;
1011

1112
namespace PnP.PowerShell.Commands.Lists
1213
{
@@ -15,6 +16,7 @@ namespace PnP.PowerShell.Commands.Lists
1516
public class GetDefaultColumnValues : PnPWebCmdlet
1617
{
1718
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
19+
[ArgumentCompleter(typeof(ListNameCompleter))]
1820
public ListPipeBind List;
1921

2022
protected override void ExecuteCmdlet()

src/Commands/Lists/GetLibraryFileVersionBatchDeleteJobStatus.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.SharePoint.Client;
22

33
using PnP.Framework.Utilities;
4+
using PnP.PowerShell.Commands.Base.Completers;
45
using PnP.PowerShell.Commands.Base.PipeBinds;
56
using PnP.PowerShell.Commands.Model.SharePoint;
67
using System;
@@ -15,6 +16,7 @@ public class GetLibraryFileVersionBatchDeleteJobStatus : PnPWebCmdlet
1516
{
1617
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
1718
[ValidateNotNull]
19+
[ArgumentCompleter(typeof(ListNameCompleter))]
1820
public ListPipeBind Identity;
1921

2022
protected override void ExecuteCmdlet()

src/Commands/Lists/GetLibraryFileVersionExpirationReportJobStatus.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.SharePoint.Client;
22

33
using PnP.Framework.Utilities;
4+
using PnP.PowerShell.Commands.Base.Completers;
45
using PnP.PowerShell.Commands.Base.PipeBinds;
56
using PnP.PowerShell.Commands.Model.SharePoint;
67

@@ -15,6 +16,7 @@ public class GetLibraryFileVersionExpirationReportJobStatus : PnPWebCmdlet
1516
{
1617
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
1718
[ValidateNotNull]
19+
[ArgumentCompleter(typeof(ListNameCompleter))]
1820
public ListPipeBind Identity;
1921

2022
[Parameter(Mandatory = true)]

src/Commands/Lists/GetListItem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Xml.Linq;
66
using Microsoft.SharePoint.Client;
77
using PnP.PowerShell.Commands.Attributes;
8+
using PnP.PowerShell.Commands.Base.Completers;
89
using PnP.PowerShell.Commands.Base.PipeBinds;
910

1011
namespace PnP.PowerShell.Commands.Lists
@@ -28,6 +29,7 @@ public class GetListItem : PnPWebRetrievalsCmdlet<ListItem>
2829
private const string ParameterSet_BYQUERY = "By Query";
2930
private const string ParameterSet_ALLITEMS = "All Items";
3031
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, ParameterSetName = ParameterAttribute.AllParameterSets)]
32+
[ArgumentCompleter(typeof(ListNameCompleter))]
3133
public ListPipeBind List;
3234

3335
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_BYID)]

0 commit comments

Comments
 (0)