Skip to content

Commit

Permalink
Cmdlet remove-pnpcontainertype and minor changes. closes #3670. (#3689)
Browse files Browse the repository at this point in the history
* cmdlets remove-pnpcontainertype and minor changes

* cmdlets remove-pnpcontainertype and minor changes

---------

Co-authored-by: Gautam Sheth <[email protected]>
  • Loading branch information
reshmee011 and gautamdsheth authored Jan 20, 2024
1 parent d63d84d commit f36f7fa
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 5 deletions.
2 changes: 1 addition & 1 deletion documentation/Remove-PnPContainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Specify container site url or container id.
Type: ContainerPipeBind
Parameter Sets: (All)

Required: Falsegit
Required: true
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Expand Down
73 changes: 73 additions & 0 deletions documentation/Remove-PnPContainerType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPContainerType.html
external help file: PnP.PowerShell.dll-Help.xml
title: Remove-PnPContainerType
---

# Remove-PnPContainerType

## SYNOPSIS

**Required Permissions**

* SharePoint: Access to the SharePoint Tenant Administration site

The Remove-PnPContainerType cmdlet removes a trial container from the SharePoint tenant. The container to remove is specified by the Identity parameter.


## SYNTAX

```powershell
Remove-PnPContainerType [-Identity] <Guid> [-Connection <PnPConnection>]
```

## DESCRIPTION

## EXAMPLES

### EXAMPLE 1

```powershell
Remove-PnPContainerType -Identity 00be1092-0c75-028a-18db-89e57908e7d6
```

Removes the specified trial container by using the container id.

## PARAMETERS

### -Connection

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.

```yaml
Type: PnPConnection
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Identity
Specify the container id.
```yaml
Type: Guid
Parameter Sets: (All)

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
## RELATED LINKS
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
4 changes: 2 additions & 2 deletions src/Commands/Admin/GetContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace PnP.PowerShell.Commands.Admin
public class GetContainer : PnPAdminCmdlet
{
[Parameter(Mandatory = false, Position = 0, ValueFromPipeline = true)]
public Guid OwningApplicationId;
public ContainerPipeBind Identity { get; set; }

[Parameter(Mandatory = false)]
public ContainerPipeBind Identity { get; set; }
public Guid OwningApplicationId;

[Parameter(Mandatory = false)]
public SwitchParameter Paged { get; set; }
Expand Down
1 change: 0 additions & 1 deletion src/Commands/Admin/GetDeletedContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class PnPDeletedContainer : PnPAdminCmdlet
{
protected override void ExecuteCmdlet()
{

IList<SPDeletedContainerProperties> deletedContainers = Tenant.GetSPODeletedContainers();
AdminContext.ExecuteQueryRetry();
WriteObject(deletedContainers, true);
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Admin/RemoveContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace PnP.PowerShell.Commands.Admin
[Cmdlet(VerbsCommon.Remove, "PnPContainer")]
public class RemoveContainer : PnPAdminCmdlet
{
[Parameter(Mandatory = true)]
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
public ContainerPipeBind Identity { get; set; }

protected override void ExecuteCmdlet()
Expand Down
24 changes: 24 additions & 0 deletions src/Commands/Admin/RemoveContainerType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Base;
using System.Management.Automation;
using PnP.PowerShell.Commands.Base.PipeBinds;
using System;

namespace PnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsCommon.Remove, "PnPContainerType")]
public class RemoveContainerType : PnPAdminCmdlet
{
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0)]
public Guid Identity { get; set; }

protected override void ExecuteCmdlet()
{
SPDeletedContainerTypeProperties sPDeletedContainerTypeProperties = new SPDeletedContainerTypeProperties();
sPDeletedContainerTypeProperties.ContainerTypeId = Identity;
Tenant.RemoveSPOContainerType(sPDeletedContainerTypeProperties);
AdminContext.ExecuteQueryRetry();
}
}
}

0 comments on commit f36f7fa

Please sign in to comment.