Skip to content

Commit bfb9de4

Browse files
authored
Merge pull request #4821 from KoenZomers/GetPnPContainerArchiveStatus
Adding new mandatory parameter `-ArchiveStatus` to `Get-PnPContainer`
2 parents 9f5ec5b + 8aff673 commit bfb9de4

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
9696
- `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)
9797
- 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)
9898
- Visual Studio Code launch profiles have been cleaned up and restructured [#4808](https://github.com/pnp/powershell/pull/4804)
99+
- 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)
99100

100101
### Fixed
101102

documentation/Get-PnPContainer.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Returns one or more Containers in a SharePoint Embedded application.
2020
## SYNTAX
2121

2222
```powershell
23-
Get-PnPContainer [-Identity <ContainerPipeBind>] [-OwningApplicationId <Guid>] [-Paged <switchparameter>] [-PagingToken <string>][-SortOrder <SortOrder>] [-Connection <PnPConnection>]
23+
Get-PnPContainer [-Identity <ContainerPipeBind>] [-OwningApplicationId <Guid>] [-Paged <switchparameter>] [-PagingToken <string>][-SortOrder <SortOrder>] [-ArchiveStatus <SPContainerArchiveStatusFilterProperties>] [-Connection <PnPConnection>]
2424
```
2525

2626
## DESCRIPTION
@@ -50,6 +50,26 @@ Returns the properties of the specified container by using the container url
5050

5151
## PARAMETERS
5252

53+
### -ArchiveStatus
54+
55+
The ArchiveStatus parameter is used to display containers in various stages of archiving. The following states are supported:
56+
- Archived: Displays containers in all archived states.
57+
- RecentlyArchived: Displays containers in the "Recently archived" state.
58+
- FullyArchived: Displays containers in the "Fully archived" state.
59+
- Reactivating: Displays containers in the "Reactivating" state.
60+
- NotArchived: Displays active containers
61+
62+
```yaml
63+
Type: SPContainerArchiveStatusFilterProperties
64+
Parameter Sets: (All)
65+
66+
Required: False
67+
Position: Named
68+
Default value: NotArchived
69+
Accept pipeline input: False
70+
Accept wildcard characters: False
71+
```
72+
5373
### -Connection
5474
5575
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.

src/Commands/Admin/GetContainer.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ public class GetContainer : PnPSharePointOnlineAdminCmdlet
2828
[Parameter(Mandatory = false)]
2929
public SortOrder? SortByStorage { get; set; }
3030

31+
[Parameter(Mandatory = false)]
32+
public SPContainerArchiveStatusFilterProperties ArchiveStatus { get; set; } = SPContainerArchiveStatusFilterProperties.NotArchived;
33+
3134
protected override void ExecuteCmdlet()
3235
{
3336
if (Identity != null)
3437
{
35-
var containerProperties = Identity.GetContainer(Tenant);
38+
var containerProperties = Identity.GetContainer(Tenant);
3639
WriteObject(containerProperties);
3740
}
3841
else if (OwningApplicationId != Guid.Empty)
@@ -41,11 +44,11 @@ protected override void ExecuteCmdlet()
4144
if (SortByStorage.HasValue)
4245
{
4346
bool ascending = SortByStorage == SortOrder.Ascending;
44-
clientResult = Tenant.GetSortedSPOContainersByApplicationId(OwningApplicationId, ascending, Paged, PagingToken);
47+
clientResult = Tenant.GetSortedSPOContainersByApplicationId(OwningApplicationId, ascending, Paged, PagingToken, ArchiveStatus);
4548
}
4649
else
4750
{
48-
clientResult = Tenant.GetSPOContainersByApplicationId(OwningApplicationId, Paged, PagingToken);
51+
clientResult = Tenant.GetSPOContainersByApplicationId(OwningApplicationId, Paged, PagingToken, ArchiveStatus);
4952
}
5053
AdminContext.ExecuteQueryRetry();
5154
IList<SPContainerProperties> containerCollection = clientResult.Value.ContainerCollection;
@@ -65,8 +68,8 @@ protected override void ExecuteCmdlet()
6568
{
6669
WriteObject("End of containers view.");
6770
}
68-
}
69-
}
71+
}
72+
}
7073
}
7174
else
7275
{

0 commit comments

Comments
 (0)