forked from pnp/powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetIndexedPropertyKeys.cs
34 lines (32 loc) · 1 KB
/
GetIndexedPropertyKeys.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Management.Automation;
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Base.Completers;
using PnP.PowerShell.Commands.Base.PipeBinds;
namespace PnP.PowerShell.Commands
{
[Cmdlet(VerbsCommon.Get, "PnPIndexedPropertyKeys")]
[OutputType(typeof(string))]
public class GetIndexedProperties : PnPWebCmdlet
{
[Parameter(Mandatory = false, ValueFromPipeline = true)]
[ArgumentCompleter(typeof(ListNameCompleter))]
public ListPipeBind List;
protected override void ExecuteCmdlet()
{
if (List != null)
{
var list = List.GetList(CurrentWeb);
if (list != null)
{
var keys = list.GetIndexedPropertyBagKeys();
WriteObject(keys, true);
}
}
else
{
var keys = CurrentWeb.GetIndexedPropertyBagKeys();
WriteObject(keys, true);
}
}
}
}