diff --git a/CHANGELOG.md b/CHANGELOG.md index c4cd729dc..345fb5e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `Convert-PnPFile` cmdlet which allows for a file to be converted to from one format to another. [#3435](https://github.com/pnp/powershell/pull/3435) & [#3643](https://github.com/pnp/powershell/pull/3643) - Added `Merge-PnPTerm` cmdlet which allows merging of one term into another. [#3638](https://github.com/pnp/powershell/pull/3638) - Added `Get-PnPDeletedContainer` cmdlet which returns a list of all deleted Containers in the recycle bin. [#3648](https://github.com/pnp/powershell/pull/3648) +- Added `Get-PnPContainerTypeConfiguration` cmdlet which fetches the container type configuration values. ### Contributors diff --git a/documentation/Get-PnPContainerTypeConfiguration.md b/documentation/Get-PnPContainerTypeConfiguration.md new file mode 100644 index 000000000..19b9eb5fb --- /dev/null +++ b/documentation/Get-PnPContainerTypeConfiguration.md @@ -0,0 +1,72 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPContainerTypeConfiguration.html +external help file: PnP.PowerShell.dll-Help.xml +title: Get-PnPContainerTypeConfiguration +--- + +# Get-PnPContainerTypeConfiguration + +## SYNOPSIS + +**Required Permissions** + +* SharePoint: Access to the SharePoint Tenant Administration site + +Returns container type configuration of a SharePoint repository services application. + +## SYNTAX + +```powershell +Get-PnPContainerTypeConfiguration [[-Identity] ] [-Connection ] +``` + +## DESCRIPTION + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Get-PnPContainerTypeConfiguration -Identity a187e399-0c36-4b98-8f04-1edc167a0996 +``` + +Returns a container type configuration data of the application created under the specified SharePoint repository services application. + + +## PARAMETERS + +### -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 +``` + +### -Identity + +Specify container type GUID + +```yaml +Type: ContainerPipeBind +Parameter Sets: (All) + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +## RELATED LINKS + +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) \ No newline at end of file diff --git a/src/Commands/Admin/GetContainerTypeConfiguration.cs b/src/Commands/Admin/GetContainerTypeConfiguration.cs new file mode 100644 index 000000000..679196cfd --- /dev/null +++ b/src/Commands/Admin/GetContainerTypeConfiguration.cs @@ -0,0 +1,29 @@ +using Microsoft.Online.SharePoint.TenantAdministration; +using Microsoft.SharePoint.Client; +using PnP.PowerShell.Commands.Base; +using System; +using System.Management.Automation; + +namespace PnP.PowerShell.Commands.Admin +{ + [Cmdlet(VerbsCommon.Get, "PnPContainerTypeConfiguration")] + public class GetContainerTypeConfiguration : PnPAdminCmdlet + { + [Parameter(Mandatory = true)] + public Guid Identity; + + protected override void ExecuteCmdlet() + { + if (Identity == Guid.Empty) + { + throw new ArgumentException($"Identity {Identity} value is invalid"); + } + ClientResult sPOContainerTypeConfigurationByContainerTypeId = Tenant.GetSPOContainerTypeConfigurationByContainerTypeId(Identity); + AdminContext.ExecuteQuery(); + if (sPOContainerTypeConfigurationByContainerTypeId != null && sPOContainerTypeConfigurationByContainerTypeId.Value != null) + { + WriteObject(new Model.SharePoint.SPContainerTypeConfigurationPropertiesObj(sPOContainerTypeConfigurationByContainerTypeId.Value)); + } + } + } +} diff --git a/src/Commands/Model/SharePoint/SPContainerTypeConfigurationPropertiesObj.cs b/src/Commands/Model/SharePoint/SPContainerTypeConfigurationPropertiesObj.cs new file mode 100644 index 000000000..60580f280 --- /dev/null +++ b/src/Commands/Model/SharePoint/SPContainerTypeConfigurationPropertiesObj.cs @@ -0,0 +1,35 @@ +using Microsoft.Online.SharePoint.TenantAdministration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace PnP.PowerShell.Commands.Model.SharePoint +{ + public class SPContainerTypeConfigurationPropertiesObj + { + public Guid ContainerTypeId { get; private set; } + + public Guid OwningApplicationId { get; private set; } + + public string ContainerTypeName { get; private set; } + + public SPContainerTypeBillingClassification Classification { get; private set; } + + public bool DiscoverabilityDisabled { get; private set; } + + public bool SharingRestricted { get; private set; } + + internal SPContainerTypeConfigurationPropertiesObj(SPContainerTypeConfigurationProperties containerTypeConfigurationProperties) + { + ContainerTypeId = containerTypeConfigurationProperties.ContainerTypeId; + OwningApplicationId = containerTypeConfigurationProperties.OwningAppId; + ContainerTypeName = containerTypeConfigurationProperties.ContainerTypeName; + Classification = containerTypeConfigurationProperties.Classification; + DiscoverabilityDisabled = containerTypeConfigurationProperties.IsDiscoverablilityDisabled; + SharingRestricted = containerTypeConfigurationProperties.IsSharingRestricted; + } + } +}