/
GetListDesign.cs
39 lines (34 loc) · 1.22 KB
/
GetListDesign.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
35
36
37
38
39
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Base.PipeBinds;
using System.Management.Automation;
namespace PnP.PowerShell.Commands
{
[Cmdlet(VerbsCommon.Get, "PnPListDesign")]
[OutputType(typeof(TenantListDesign))]
public class GetListDesign : PnPAdminCmdlet
{
[Parameter(Mandatory = false, Position = 0, ValueFromPipeline = true)]
public TenantListDesignPipeBind Identity;
protected override void ExecuteCmdlet()
{
if (ParameterSpecified(nameof(Identity)))
{
var listDesigns = Identity.GetTenantListDesign(Tenant);
if(listDesigns.Length == 0)
{
WriteVerbose($"No list designs with the identity provided through {nameof(Identity)} have been found");
}
WriteObject(listDesigns, true);
}
else
{
var designs = Tenant.GetListDesigns();
AdminContext.Load(designs);
AdminContext.ExecuteQueryRetry();
WriteObject(designs, true);
}
}
}
}