From 0d546e744f3a0115cf14700f4d8231c8bf4a96a0 Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Sat, 11 May 2024 15:55:41 +0100 Subject: [PATCH] New cmdlet for getcontainerType and minor changes to docs --- documentation/Get-PnPContainer.md | 2 +- documentation/Get-PnPContainerType.md | 55 +++++++++++++++++++ .../Get-PnPContainerTypeConfiguration.md | 2 +- documentation/New-PnPContainerType.md | 4 +- documentation/Remove-PnPContainerType.md | 2 +- src/Commands/Admin/GetContainerType.cs | 23 ++++++++ 6 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 documentation/Get-PnPContainerType.md create mode 100644 src/Commands/Admin/GetContainerType.cs diff --git a/documentation/Get-PnPContainer.md b/documentation/Get-PnPContainer.md index c5d2226ca..de71726b5 100644 --- a/documentation/Get-PnPContainer.md +++ b/documentation/Get-PnPContainer.md @@ -20,7 +20,7 @@ Returns one or more Containers in a SharePoint repository services application. ## SYNTAX ```powershell -Get-PnPContainer [[-Identity] ] [-OwningApplicationId [Guid]] [-Paged [switchparameter]] [-PagingToken [string]][-Connection ] +Get-PnPContainer [-Identity ] [-OwningApplicationId ] [-Paged ] [-PagingToken ][-Connection ] ``` ## DESCRIPTION diff --git a/documentation/Get-PnPContainerType.md b/documentation/Get-PnPContainerType.md new file mode 100644 index 000000000..fa7605dd7 --- /dev/null +++ b/documentation/Get-PnPContainerType.md @@ -0,0 +1,55 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPContainerType.html +external help file: PnP.PowerShell.dll-Help.xml +title: Get-PnPContainerType +--- + +# Get-PnPContainerType + +## SYNOPSIS + +**Required Permissions** + +* SharePoint Embedded Administrator or Global Administrator is required + + Returns the list of Container Types created for a SharePoint Embedded Application in the tenant. + +## SYNTAX + +```powershell +Get-PnPContainerType [-Connection ] +``` + +## DESCRIPTION + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Get-PnPContainerType +``` + +Returns the list of Container Types created for a SharePoint Embedded Application in the tenant.pplication. + +### -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 +``` + +## RELATED LINKS + +[SharePoint Embedded Container Types](https://learn.microsoft.com/en-us/sharepoint/dev/embedded/concepts/app-concepts/containertypes) +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) \ No newline at end of file diff --git a/documentation/Get-PnPContainerTypeConfiguration.md b/documentation/Get-PnPContainerTypeConfiguration.md index 19b9eb5fb..3cb5af17c 100644 --- a/documentation/Get-PnPContainerTypeConfiguration.md +++ b/documentation/Get-PnPContainerTypeConfiguration.md @@ -20,7 +20,7 @@ Returns container type configuration of a SharePoint repository services applica ## SYNTAX ```powershell -Get-PnPContainerTypeConfiguration [[-Identity] ] [-Connection ] +Get-PnPContainerTypeConfiguration [-Identity ] [-Connection ] ``` ## DESCRIPTION diff --git a/documentation/New-PnPContainerType.md b/documentation/New-PnPContainerType.md index 1a82673b0..f7047ac1e 100644 --- a/documentation/New-PnPContainerType.md +++ b/documentation/New-PnPContainerType.md @@ -13,9 +13,9 @@ online version: https://pnp.github.io/powershell/cmdlets/New-PnPContainerType.ht **Required Permissions** - * Microsoft 365 SharePoint Administrator role is required + * SharePoint Embedded Administrator or Global Administrator role is required -Creates a new SharePoint Container Type. Refer to [Hands on Lab - Setup and Configure SharePoint Embedded](https://learn.microsoft.com/en-us/sharepoint/dev/embedded/mslearn/m01-05-hol) for more details. +Create a Container Type for a SharePoint Embedded Application. Refer to [Hands on Lab - Setup and Configure SharePoint Embedded](https://learn.microsoft.com/en-us/sharepoint/dev/embedded/mslearn/m01-05-hol) for more details. ## SYNTAX diff --git a/documentation/Remove-PnPContainerType.md b/documentation/Remove-PnPContainerType.md index f173357dc..0e31e4ace 100644 --- a/documentation/Remove-PnPContainerType.md +++ b/documentation/Remove-PnPContainerType.md @@ -13,7 +13,7 @@ title: Remove-PnPContainerType **Required Permissions** -* SharePoint: Access to the SharePoint Tenant Administration site +* SharePoint Embedded Administrator or Global Administrator role is required The Remove-PnPContainerType cmdlet removes a trial container from the SharePoint tenant. The container to remove is specified by the Identity parameter. diff --git a/src/Commands/Admin/GetContainerType.cs b/src/Commands/Admin/GetContainerType.cs new file mode 100644 index 000000000..9311de264 --- /dev/null +++ b/src/Commands/Admin/GetContainerType.cs @@ -0,0 +1,23 @@ +using Microsoft.Online.SharePoint.TenantAdministration; +using Microsoft.SharePoint.Client; +using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base.PipeBinds; +using PnP.PowerShell.Commands.Utilities; +using System; +using System.Collections.Generic; +using System.Management.Automation; + +namespace PnP.PowerShell.Commands.Admin +{ + [Cmdlet(VerbsCommon.Get, "PnPContainerType")] + + public class PnPContainerType : PnPAdminCmdlet + { + protected override void ExecuteCmdlet() + { + IList containerTypes = Tenant.GetSPOContainerTypes(SPContainerTypeTenantType.OwningTenant); + AdminContext.ExecuteQueryRetry(); + WriteObject(containerTypes, true); + } + } +}