diff --git a/CHANGELOG.md b/CHANGELOG.md index 6126a68ba..c4e47e029 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - `Connect-PnPOnline` will now throw a much clearer error message if the site to be connected doesn't exist when using the legacy Client Id with Secret (ACS) authentication mode. [#2707](https://github.com/pnp/powershell/pull/2707) - Properties of `Get-PnPAzureADServicePrincipal` are now all typed instead of some of them returning unparsed JSON fragments. [#2717](https://github.com/pnp/powershell/pull/2717) - Marked `Get-PnPSubscribeSharePointNewsDigest` and `Set-PnPSubscribeSharePointNewsDigest` as obsolete 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. [#2720](https://github.com/pnp/powershell/pull/2720) +- Changed `Add-PnPTeamsChannel` to no longer require an `-OwnerUPN` to be provided when specifying `-ChannelType Standard` [#2786](https://github.com/pnp/powershell/pull/2786) ### Removed diff --git a/src/Commands/Teams/AddTeamsChannel.cs b/src/Commands/Teams/AddTeamsChannel.cs index 9593cff26..8041bc7a4 100644 --- a/src/Commands/Teams/AddTeamsChannel.cs +++ b/src/Commands/Teams/AddTeamsChannel.cs @@ -33,11 +33,12 @@ public class AddTeamsChannel : PnPGraphCmdlet public string Description; [Parameter(Mandatory = true, ParameterSetName = ParameterSET_PRIVATE)] - [Obsolete("Use TeamMembershipType instead.")] + [Obsolete($"Use {nameof(ChannelType)} instead.")] public SwitchParameter Private; + [Parameter(Mandatory = false, ParameterSetName = ParameterSET_STANDARD)] [Parameter(Mandatory = true, ParameterSetName = ParameterSET_SPECIFIC)] - public TeamsChannelType ChannelType; + public TeamsChannelType ChannelType = TeamsChannelType.Standard; [Parameter(Mandatory = true, ParameterSetName = ParameterSET_SPECIFIC)] [Parameter(Mandatory = true, ParameterSetName = ParameterSET_PRIVATE)] @@ -55,15 +56,9 @@ protected override void ExecuteCmdlet() throw new PSArgumentException("Group not found"); } - switch (ParameterSetName) + if(ChannelType != TeamsChannelType.Standard && !ParameterSpecified(nameof(OwnerUPN))) { - case ParameterSET_PRIVATE: - ChannelType = TeamsChannelType.Private; - break; - - case ParameterSET_STANDARD: - ChannelType = TeamsChannelType.Standard; - break; + throw new PSArgumentException("OwnerUPN is required when using the non standard channel type", nameof(OwnerUPN)); } try @@ -84,4 +79,4 @@ protected override void ExecuteCmdlet() } } } -} \ No newline at end of file +}