diff --git a/CHANGELOG.md b/CHANGELOG.md index e6cf60b07..15d8bd6ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - `Get-PnPTenant` now uses nullable types for the properties that can return null if the property is not set or could not be retrieved. Beware that the property `PublicCdnOrigins` has been renamed to `PublicCdnOriginParsed `. All other property names will remain the same. [#4722](https://github.com/pnp/powershell/pull/4722) - Removed `New-PnPMicrosoft365Group` setting the group visibility options twice when providing `-HideFromAddressLists` and/or `-HideFromOutlookClients` and adding logging around trying to set the group visibility [#4791](https://github.com/pnp/powershell/pull/4791) - Visual Studio Code launch profiles have been cleaned up and restructured [#4808](https://github.com/pnp/powershell/pull/4804) +- The cmdlet `Get-PnPContainer` now has a new optional parameter `-ArchiveStatus` which allows filtering SharePoint Online Embedded containers by archival status [#4821](https://github.com/pnp/powershell/pull/4821) ### Fixed diff --git a/documentation/Get-PnPContainer.md b/documentation/Get-PnPContainer.md index 5a6f8319c..030463dce 100644 --- a/documentation/Get-PnPContainer.md +++ b/documentation/Get-PnPContainer.md @@ -20,7 +20,7 @@ Returns one or more Containers in a SharePoint Embedded application. ## SYNTAX ```powershell -Get-PnPContainer [-Identity ] [-OwningApplicationId ] [-Paged ] [-PagingToken ][-SortOrder ] [-Connection ] +Get-PnPContainer [-Identity ] [-OwningApplicationId ] [-Paged ] [-PagingToken ][-SortOrder ] [-ArchiveStatus ] [-Connection ] ``` ## DESCRIPTION @@ -50,6 +50,26 @@ Returns the properties of the specified container by using the container url ## PARAMETERS +### -ArchiveStatus + +The ArchiveStatus parameter is used to display containers in various stages of archiving. The following states are supported: +- Archived: Displays containers in all archived states. +- RecentlyArchived: Displays containers in the "Recently archived" state. +- FullyArchived: Displays containers in the "Fully archived" state. +- Reactivating: Displays containers in the "Reactivating" state. +- NotArchived: Displays active containers + +```yaml +Type: SPContainerArchiveStatusFilterProperties +Parameter Sets: (All) + +Required: False +Position: Named +Default value: NotArchived +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -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. diff --git a/src/Commands/Admin/GetContainer.cs b/src/Commands/Admin/GetContainer.cs index b4f1c6295..70e4e1aa2 100644 --- a/src/Commands/Admin/GetContainer.cs +++ b/src/Commands/Admin/GetContainer.cs @@ -28,11 +28,14 @@ public class GetContainer : PnPSharePointOnlineAdminCmdlet [Parameter(Mandatory = false)] public SortOrder? SortByStorage { get; set; } + [Parameter(Mandatory = false)] + public SPContainerArchiveStatusFilterProperties ArchiveStatus { get; set; } = SPContainerArchiveStatusFilterProperties.NotArchived; + protected override void ExecuteCmdlet() { if (Identity != null) { - var containerProperties = Identity.GetContainer(Tenant); + var containerProperties = Identity.GetContainer(Tenant); WriteObject(containerProperties); } else if (OwningApplicationId != Guid.Empty) @@ -41,11 +44,11 @@ protected override void ExecuteCmdlet() if (SortByStorage.HasValue) { bool ascending = SortByStorage == SortOrder.Ascending; - clientResult = Tenant.GetSortedSPOContainersByApplicationId(OwningApplicationId, ascending, Paged, PagingToken); + clientResult = Tenant.GetSortedSPOContainersByApplicationId(OwningApplicationId, ascending, Paged, PagingToken, ArchiveStatus); } else { - clientResult = Tenant.GetSPOContainersByApplicationId(OwningApplicationId, Paged, PagingToken); + clientResult = Tenant.GetSPOContainersByApplicationId(OwningApplicationId, Paged, PagingToken, ArchiveStatus); } AdminContext.ExecuteQueryRetry(); IList containerCollection = clientResult.Value.ContainerCollection; @@ -65,8 +68,8 @@ protected override void ExecuteCmdlet() { WriteObject("End of containers view."); } - } - } + } + } } else {