Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command Get-PnPPowerApp #2794

Merged
merged 9 commits into from
Mar 23, 2023
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `Get-PnPAzureACSPrincipal` cmdlet to retrieve list of installed Azure ACS Principals in the site collection or tenant. [#2920](https://github.com/pnp/powershell/pull/2920)
- Added `-LogoFilePath` parameter to `Register-PnPAzureADApp` cmdlet to allow setting the logo for the Azure AD app. [#2881](https://github.com/pnp/powershell/pull/2881)
- Added support for `-Verbose` in `Move-PnPFile` which will show if it has problems determining if the destination location is a folder or a file [#2888](https://github.com/pnp/powershell/pull/2888)
- Added `-Identity` option to `Get-PnPPowerPlatformEnvironment` which allows retrieval of one specific environment by its displayname or id. [#2794](https://github.com/pnp/powershell/pull/2794)
- Added `Get-PnPPowerApp` which allows PowerApps to be retrieved [#2794](https://github.com/pnp/powershell/pull/2794)

### Changed

Expand All @@ -77,6 +79,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed support for PowerShell 5, only PowerShell 7.2 and later will be supported from here onwards [#2764](https://github.com/pnp/powershell/pull/2764)
- Removed `Get-PnPSubscribeSharePointNewsDigest` and `Set-PnPSubscribeSharePointNewsDigest` as the implementation behind these features has been changed in SharePoint Online causing them no longer to work. At present, there's no alternative for this that we can call into thus we will have to remove these in a future version. There is a Design Change Request open with the Program Group to add back APIs for doing this. If that will be accepted and implemented, we will add these back again. [#2720](https://github.com/pnp/powershell/pull/2720)
- Removed `-ReturnTyped` parameter from the `Get-PnPField` cmdlet. The retrieved fields will always be returned by their `TypeKind`. [#2849](https://github.com/pnp/powershell/pull/2849)
- Removed alias `Get-PnPFlowEnvironment` from `Get-PnPPowerPlatformEnvironment`. Please use the latter going forward. [#2794](https://github.com/pnp/powershell/pull/2794)

### Fixed

Expand Down
1 change: 1 addition & 0 deletions MIGRATE-1.0-to-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Using PnP PowerShell in Azure functions ? You might be required to change the Pn
| Export-PnPTaxonomy | - | - | The cmdlet does not support export of taxonomy using `UTF-7` encoding. If `UTF-7` is specified, it will switch to `UTF-8` encoding |
| Get-PnPField | ReturnTyped | - | The cmdlet will always return the typed object of the field. |
| Get-PnPUserProfileProperty | - | - | Additional user profile properties are no longer returned under UserProfileProperties but instead will be directly under the returned instance |
| Get-PnPFlowEnvironment | - | - | The alias on the cmdlet has been removed. Use `PnPPowerPlatformEnvironment` instead. |

## Other notable changes

Expand Down
32 changes: 21 additions & 11 deletions documentation/Get-PnPFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Returns the flows for a given environment
## SYNTAX

```powershell
Get-PnPFlow -Environment <PowerAutomateEnvironmentPipeBind> [-AsAdmin] [-Identity <PowerPlatformPipeBind>]
[-Connection <PnPConnection>] [<CommonParameters>]
Get-PnPFlow [-Environment <PowerAutomateEnvironmentPipeBind>] [-AsAdmin] [-Identity <PowerPlatformPipeBind>]
[-Connection <PnPConnection>] [-Verbose]
```

## DESCRIPTION
Expand All @@ -31,17 +31,15 @@ This cmdlet returns the flows for a given environment.

### Example 1
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Get-PnPFlow -Environment $environment
Get-PnPPowerPlatformEnvironment -Identity "MyOrganization (default)" | Get-PnPFlow
```
This returns all the flows for a given Power Platform environment

### Example 2
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Get-PnPFlow -Environment $environment -Identity fba63225-baf9-4d76-86a1-1b42c917a182
Get-PnPFlow -Identity fba63225-baf9-4d76-86a1-1b42c917a182
```
This returns a specific flow
This returns a specific flow from the default environment

## PARAMETERS

Expand All @@ -53,9 +51,9 @@ Type: PowerAutomateEnvironmentPipeBind
Parameter Sets: (All)
Aliases:

Required: True
Required: False
Position: Named
Default value: None
Default value: The default environment
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down Expand Up @@ -106,8 +104,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS
### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.

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

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
125 changes: 125 additions & 0 deletions documentation/Get-PnPPowerApp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPPowerApp.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPPowerApp
---

# Get-PnPPowerApp

## SYNOPSIS

**Required Permissions**

* Azure: management.azure.com

Returns the Power Apps for a given environment

## SYNTAX

```powershell
Get-PnPPowerApp [-Environment <PowerPlatformEnvironmentPipeBind>] [-AsAdmin] [-Identity <PowerAppPipeBind>]
[-Connection <PnPConnection>] [-Verbose]
```

## DESCRIPTION
This cmdlet returns the Power Apps for a given enviroment.

## EXAMPLES

### Example 1
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Get-PnPPowerApp -Environment $environment
```
This returns all the apps for a given Power Platform environment

### Example 2
```powershell
$environment = Get-PnPPowerPlatformEnvironment
Get-PnPPowerApp -Environment $environment -Identity fba63225-baf9-4d76-86a1-1b42c917a182
```
This returns a specific app

## PARAMETERS

### -Environment
The name of the Power Platform environment or an Environment object to retrieve the available Power Apps for.

```yaml
Type: PowerPlatformEnvironmentPipeBind
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: The default environment
Accept pipeline input: True
Accept wildcard characters: False
```

### -Identity
The Id of the app to retrieve.

```yaml
Type: PowerAppPipeBind
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AsAdmin
If specified returns all the Power Apps as admin. If not specified only the apps for the current user will be returned.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
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.

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

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.

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

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
52 changes: 48 additions & 4 deletions documentation/Get-PnPPowerPlatformEnvironment.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ Retrieves the Microsoft Power Platform environments for the current tenant.

## SYNTAX

### Default (Default)

```powershell
Get-PnPPowerPlatformEnvironment [-IsDefault] [-Connection <PnPConnection>] [-Verbose]
```

### By Identity

```powershell
Get-PnPPowerPlatformEnvironment [-Connection <PnPConnection>] [<CommonParameters>]
Get-PnPPowerPlatformEnvironment -Identity <PowerPlatformEnvironmentPipeBind> [-Connection <PnPConnection>] [-Verbose]
```

## DESCRIPTION
This cmdlet retrieves the Microsoft Power Platform environments for the current tenant
This cmdlet retrieves all of the Microsoft Power Platform environments for the current tenant

## EXAMPLES

Expand All @@ -33,7 +41,7 @@ This cmdlet retrieves the Microsoft Power Platform environments for the current
Get-PnPPowerPlatformEnvironment
```

This cmdlets returns the Power Platform environments for the current tenant.
This cmdlets returns all of the Power Platform environments for the current tenant.

### Example 2
```powershell
Expand All @@ -42,14 +50,36 @@ Get-PnPPowerPlatformEnvironment -IsDefault $true

This cmdlets returns the default Power Platform environment for the current tenant.

### Example 3
```powershell
Get-PnPPowerPlatformEnvironment -Identity "MyOrganization (default)"
```

This cmdlets returns the Power Platform environment with the provided display name for the current tenant.

## PARAMETERS

### -Identity
Allows specifying an environment display name or internal name to retrieve a specific environment.

```yaml
Type: bool
Parameter Sets: By Identity
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -IsDefault
Allows retrieval of the default Power Platform environment by passing in `-IsDefault $true`. When passing in `-IsDefault $false` you will get all non default environments. If not provided at all, all available environments, both default and non-default, will be returned.

```yaml
Type: bool
Parameter Sets: (All)
Parameter Sets: Default
Aliases:

Required: False
Expand All @@ -75,6 +105,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.

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

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
4 changes: 0 additions & 4 deletions src/Commands/Apps/AddApp.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using PnP.Framework.ALM;
using PnP.Framework.Enums;

using PnP.PowerShell.Commands.Enums;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Apps
{
[Cmdlet(VerbsCommon.Add, "PnPApp")]
public class AddApp : PnPSharePointCmdlet
{

[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)]
public string Path;

Expand Down Expand Up @@ -52,7 +49,6 @@ protected override void ExecuteCmdlet()
{
result = manager.GetAvailable(result.Id, Scope);
}

}
WriteObject(result);
}
Expand Down
26 changes: 26 additions & 0 deletions src/Commands/Base/PipeBinds/PowerAppPipeBind.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace PnP.PowerShell.Commands.Base.PipeBinds
{
public sealed class PowerAppPipeBind
{
private readonly string _name;
private readonly Model.PowerPlatform.PowerApp.PowerApp _powerapp;
public PowerAppPipeBind(string input)
{
_name = input;
}

public PowerAppPipeBind(Model.PowerPlatform.PowerApp.PowerApp powerapp)
{
_powerapp = powerapp;
}

public string GetName()
{
if (_powerapp != null)
{
return _powerapp.Name;
}
return _name;
}
}
}
Loading