Skip to content

Commit f36f7fa

Browse files
Cmdlet remove-pnpcontainertype and minor changes. closes #3670. (#3689)
* cmdlets remove-pnpcontainertype and minor changes * cmdlets remove-pnpcontainertype and minor changes --------- Co-authored-by: Gautam Sheth <gautamdsheth@outlook.com>
1 parent d63d84d commit f36f7fa

File tree

6 files changed

+101
-5
lines changed

6 files changed

+101
-5
lines changed

documentation/Remove-PnPContainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Specify container site url or container id.
7070
Type: ContainerPipeBind
7171
Parameter Sets: (All)
7272

73-
Required: Falsegit
73+
Required: true
7474
Position: 0
7575
Default value: None
7676
Accept pipeline input: True (ByValue)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
Module Name: PnP.PowerShell
3+
schema: 2.0.0
4+
applicable: SharePoint Online
5+
online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPContainerType.html
6+
external help file: PnP.PowerShell.dll-Help.xml
7+
title: Remove-PnPContainerType
8+
---
9+
10+
# Remove-PnPContainerType
11+
12+
## SYNOPSIS
13+
14+
**Required Permissions**
15+
16+
* SharePoint: Access to the SharePoint Tenant Administration site
17+
18+
The Remove-PnPContainerType cmdlet removes a trial container from the SharePoint tenant. The container to remove is specified by the Identity parameter.
19+
20+
21+
## SYNTAX
22+
23+
```powershell
24+
Remove-PnPContainerType [-Identity] <Guid> [-Connection <PnPConnection>]
25+
```
26+
27+
## DESCRIPTION
28+
29+
## EXAMPLES
30+
31+
### EXAMPLE 1
32+
33+
```powershell
34+
Remove-PnPContainerType -Identity 00be1092-0c75-028a-18db-89e57908e7d6
35+
```
36+
37+
Removes the specified trial container by using the container id.
38+
39+
## PARAMETERS
40+
41+
### -Connection
42+
43+
Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
44+
45+
```yaml
46+
Type: PnPConnection
47+
Parameter Sets: (All)
48+
49+
Required: False
50+
Position: Named
51+
Default value: None
52+
Accept pipeline input: False
53+
Accept wildcard characters: False
54+
```
55+
56+
### -Identity
57+
58+
Specify the container id.
59+
60+
```yaml
61+
Type: Guid
62+
Parameter Sets: (All)
63+
64+
Required: True
65+
Position: 0
66+
Default value: None
67+
Accept pipeline input: True (ByValue)
68+
Accept wildcard characters: False
69+
```
70+
71+
## RELATED LINKS
72+
73+
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)

src/Commands/Admin/GetContainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ namespace PnP.PowerShell.Commands.Admin
1212
public class GetContainer : PnPAdminCmdlet
1313
{
1414
[Parameter(Mandatory = false, Position = 0, ValueFromPipeline = true)]
15-
public Guid OwningApplicationId;
15+
public ContainerPipeBind Identity { get; set; }
1616

1717
[Parameter(Mandatory = false)]
18-
public ContainerPipeBind Identity { get; set; }
18+
public Guid OwningApplicationId;
1919

2020
[Parameter(Mandatory = false)]
2121
public SwitchParameter Paged { get; set; }

src/Commands/Admin/GetDeletedContainer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class PnPDeletedContainer : PnPAdminCmdlet
1414
{
1515
protected override void ExecuteCmdlet()
1616
{
17-
1817
IList<SPDeletedContainerProperties> deletedContainers = Tenant.GetSPODeletedContainers();
1918
AdminContext.ExecuteQueryRetry();
2019
WriteObject(deletedContainers, true);

src/Commands/Admin/RemoveContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PnP.PowerShell.Commands.Admin
99
[Cmdlet(VerbsCommon.Remove, "PnPContainer")]
1010
public class RemoveContainer : PnPAdminCmdlet
1111
{
12-
[Parameter(Mandatory = true)]
12+
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
1313
public ContainerPipeBind Identity { get; set; }
1414

1515
protected override void ExecuteCmdlet()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.Online.SharePoint.TenantAdministration;
2+
using Microsoft.SharePoint.Client;
3+
using PnP.PowerShell.Commands.Base;
4+
using System.Management.Automation;
5+
using PnP.PowerShell.Commands.Base.PipeBinds;
6+
using System;
7+
8+
namespace PnP.PowerShell.Commands.Admin
9+
{
10+
[Cmdlet(VerbsCommon.Remove, "PnPContainerType")]
11+
public class RemoveContainerType : PnPAdminCmdlet
12+
{
13+
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
14+
public Guid Identity { get; set; }
15+
16+
protected override void ExecuteCmdlet()
17+
{
18+
SPDeletedContainerTypeProperties sPDeletedContainerTypeProperties = new SPDeletedContainerTypeProperties();
19+
sPDeletedContainerTypeProperties.ContainerTypeId = Identity;
20+
Tenant.RemoveSPOContainerType(sPDeletedContainerTypeProperties);
21+
AdminContext.ExecuteQueryRetry();
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)