Skip to content

Commit 07fa54f

Browse files
authored
Merge pull request #3025 from KoenZomers/Issue2986
Added URL validation bypass option to `Get-PnPSiteCollectionAppCatalog`
2 parents 894f30f + afbcf7e commit 07fa54f

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1414
- Added `-OutFile` to `Invoke-PnPGraphMethod` which allows for the response to be written to a file [#2971](https://github.com/pnp/powershell/pull/2971)
1515
- Added `-OutStream` to `Invoke-PnPGraphMethod` which allows for the response to be written to a memory stream [#2976](https://github.com/pnp/powershell/pull/2976)
1616
- Added `-PreviousNode` to `Add-PnPNavigationNode` which allows for adding a navigation node after a specific node [#2940](https://github.com/pnp/powershell/pull/2940)
17+
- Added `-SkipUrlValidation` to `Get-PnPSiteCollectionAppCatalog` which allows for skipping the URL validation when retrieving the site collection app catalog making it faster but potentially returning URLs that have been renamed [#2305](https://github.com/pnp/powershell/pull/3025)
1718

1819
### Fixed
1920

@@ -23,6 +24,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2324
- Fixed regressions within the following cmdlets `Get-PnPTenantCdnEnabled`, `Get-PnPTenantCdnOrigin`, `Get-PnPTenantCdnPolicies`, `Get-PnPTenantDeletedSite`, `Get-PnPTenantInstance` [#3030](https://github.com/pnp/powershell/pull/3030)
2425
- Fixed issue where `Add-PnPSiteCollectionAdmin -PrimarySiteCollectionAdmin <user>` would require owners to be specified as well. [#3035](https://github.com/pnp/powershell/pull/3035)
2526

27+
### Removed
28+
29+
- Removed alias `Get-PnPSiteCollectionAppCatalogs` for `Get-PnPSiteCollectionAppCatalog` [#2305](https://github.com/pnp/powershell/pull/3025)
30+
2631
### Contributors
2732

2833
- [reusto]

documentation/Get-PnPSiteCollectionAppCatalog.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Returns all site collection scoped app catalogs that exist on the tenant
1515
## SYNTAX
1616

1717
```powershell
18-
Get-PnPSiteCollectionAppCatalog [-CurrentSite <SwitchParameter>] [-ExcludeDeletedSites <SwitchParameter>] [-Connection <PnPConnection>] [-Verbose]
18+
Get-PnPSiteCollectionAppCatalog [-CurrentSite <SwitchParameter>] [-ExcludeDeletedSites <SwitchParameter>] [-SkipUrlValidation <SwitchParameter>] [-Connection <PnPConnection>] [-Verbose]
1919
```
2020

2121
## DESCRIPTION
@@ -43,6 +43,20 @@ Will return all the site collection app catalogs that exist on the tenant exclud
4343

4444
## PARAMETERS
4545

46+
### -Connection
47+
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.
48+
49+
```yaml
50+
Type: PnPConnection
51+
Parameter Sets: (All)
52+
53+
Required: False
54+
Position: Named
55+
Default value: None
56+
Accept pipeline input: False
57+
Accept wildcard characters: False
58+
```
59+
4660
### -CurrentSite
4761
When provided, it will check if the currently connected to site has a site collection App Catalog and will return information on it. If the current site holds no site collection App Catalog, an empty response will be returned.
4862
@@ -71,11 +85,11 @@ Accept pipeline input: False
7185
Accept wildcard characters: False
7286
```
7387
74-
### -Connection
75-
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.
88+
### -SkipUrlValidation
89+
When provided, the site collection app catalog Urls will not be validated for if they have been renamed since their creation. This makes the cmdlet a lot faster, but it could also lead to URLs being returned that no longer exist. If not provided, for each site collection app catalog, it will look up the actual URL of the site collection app catalog and return that instead of the URL that was used when the site collection app catalog was created.
7690
7791
```yaml
78-
Type: PnPConnection
92+
Type: SwitchParameter
7993
Parameter Sets: (All)
8094

8195
Required: False

src/Commands/Admin/GetSiteCollectionAppCatalog.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.SharePoint.Client;
2-
using PnP.PowerShell.Commands.Attributes;
32
using PnP.PowerShell.Commands.Base;
43
using PnP.PowerShell.Commands.Model.SharePoint;
54
using System;
@@ -10,8 +9,6 @@
109
namespace PnP.PowerShell.Commands
1110
{
1211
[Cmdlet(VerbsCommon.Get, "PnPSiteCollectionAppCatalog")]
13-
[Alias("Get-PnPSiteCollectionAppCatalogs")]
14-
[WriteAliasWarning("Please use 'Get-PnPSiteCollectionAppCatalog' (singular). The alias 'Get-PnPSiteCollectionAppCatalogs' (plural) will be removed in a future release.")]
1512
[OutputType(typeof(IEnumerable<SiteCollectionAppCatalog>))]
1613
public class GetSiteCollectionAppCatalog : PnPAdminCmdlet
1714
{
@@ -21,6 +18,9 @@ public class GetSiteCollectionAppCatalog : PnPAdminCmdlet
2118
[Parameter(Mandatory = false)]
2219
public SwitchParameter CurrentSite;
2320

21+
[Parameter(Mandatory = false)]
22+
public SwitchParameter SkipUrlValidation;
23+
2424
protected override void ExecuteCmdlet()
2525
{
2626
WriteVerbose("Retrieving all site collection App Catalogs from SharePoint Online");
@@ -58,6 +58,13 @@ protected override void ExecuteCmdlet()
5858
appCatalogsLocalModel.Add(currentSite);
5959
}
6060

61+
if(SkipUrlValidation.ToBool())
62+
{
63+
WriteVerbose($"Skipping URL validation since the {nameof(SkipUrlValidation)} flag has been provided");
64+
WriteObject(appCatalogsLocalModel, true);
65+
return;
66+
}
67+
6168
var results = new List<SiteCollectionAppCatalog>(appCatalogsLocalModel.Count);
6269
foreach (var appCatalogLocalModel in appCatalogsLocalModel)
6370
{

0 commit comments

Comments
 (0)