diff --git a/documentation/Remove-PnPContainer.md b/documentation/Remove-PnPContainer.md index 9d474d874..c85df9e37 100644 --- a/documentation/Remove-PnPContainer.md +++ b/documentation/Remove-PnPContainer.md @@ -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) diff --git a/documentation/Remove-PnPContainerType.md b/documentation/Remove-PnPContainerType.md new file mode 100644 index 000000000..f173357dc --- /dev/null +++ b/documentation/Remove-PnPContainerType.md @@ -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] [-Connection ] +``` + +## 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) \ No newline at end of file diff --git a/src/Commands/Admin/GetContainer.cs b/src/Commands/Admin/GetContainer.cs index e6a79ef01..7128bdf9e 100644 --- a/src/Commands/Admin/GetContainer.cs +++ b/src/Commands/Admin/GetContainer.cs @@ -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; } diff --git a/src/Commands/Admin/GetDeletedContainer.cs b/src/Commands/Admin/GetDeletedContainer.cs index b1596856e..012f09d7d 100644 --- a/src/Commands/Admin/GetDeletedContainer.cs +++ b/src/Commands/Admin/GetDeletedContainer.cs @@ -14,7 +14,6 @@ public class PnPDeletedContainer : PnPAdminCmdlet { protected override void ExecuteCmdlet() { - IList deletedContainers = Tenant.GetSPODeletedContainers(); AdminContext.ExecuteQueryRetry(); WriteObject(deletedContainers, true); diff --git a/src/Commands/Admin/RemoveContainer.cs b/src/Commands/Admin/RemoveContainer.cs index 1a9fb5e52..ebd8f35ea 100644 --- a/src/Commands/Admin/RemoveContainer.cs +++ b/src/Commands/Admin/RemoveContainer.cs @@ -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() diff --git a/src/Commands/Admin/RemoveContainerType.cs b/src/Commands/Admin/RemoveContainerType.cs new file mode 100644 index 000000000..a85f9f7cf --- /dev/null +++ b/src/Commands/Admin/RemoveContainerType.cs @@ -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(); + } + } +} \ No newline at end of file