From 0f1ed1991f49fc977e68285c016716fcd9ea9b12 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Sun, 26 Feb 2023 21:39:03 +0530 Subject: [PATCH] Feature: made planner content URL mandatory for pnpteams tab --- CHANGELOG.md | 1 + MIGRATE-1.0-to-2.0.md | 2 ++ src/Commands/Teams/AddTeamsTab.cs | 5 ++++- src/Commands/Utilities/TeamsUtility.cs | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71f37e8b8..754f152de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `-UserAssignedManagedIdentityAzureResourceId` and `-UserAssignedManagedIdentityClientId` as alternatives to `-UserAssignedManagedIdentityObjectId` for `Connect-PnPOnline -ManagedIdentity` to provide an user managed identity to authenticate with. [#2813](https://github.com/pnp/powershell/pull/2813) - Added clearer error message when connecting using an expired client secret and trying to execute a command.[#2828](https://github.com/pnp/powershell/pull/2828) - Added `Undo-PnPFileCheckedOut` which allows a checked out file to discard its changes and revert to the last checked in version. [#2837](https://github.com/pnp/powershell/pull/2837) +- Added support for specifying the `-ContentUrl` configuration in `Add-PnPTeamsTab` cmdlet when trying to add a Planner as a tab in Teams channel. ### Changed diff --git a/MIGRATE-1.0-to-2.0.md b/MIGRATE-1.0-to-2.0.md index 55666d184..b81b13b8e 100644 --- a/MIGRATE-1.0-to-2.0.md +++ b/MIGRATE-1.0-to-2.0.md @@ -81,6 +81,8 @@ Using PnP PowerShell in Azure functions ? You might be required to change the Pn ## Changes to output type +- When using `Add-PnPTeamsTab` cmdlet, if you specify the `-Type SharePointPageAndList`, then `-WebSiteUrl` is mandatory. +- When using `Add-PnPTeamsTab` cmdlet, if you specify the `-Type Planner`, then `-ContentUrl` is mandatory. - The output type of `Get-PnPAzureADGroupOwner` has changed to `PnP.PowerShell.Commands.Model.Microsoft365User` - The output type of `Get-PnPAzureADGroupMember` has changed to `PnP.PowerShell.Commands.Model.Microsoft365User` - The output type of `Get-PnPAzureADGroup` has changed to `PnP.PowerShell.Commands.Model.Graph.Group` diff --git a/src/Commands/Teams/AddTeamsTab.cs b/src/Commands/Teams/AddTeamsTab.cs index 44b6a1194..8fd1af47d 100644 --- a/src/Commands/Teams/AddTeamsTab.cs +++ b/src/Commands/Teams/AddTeamsTab.cs @@ -30,6 +30,7 @@ public class AddTeamsTab : PnPGraphCmdlet, IDynamicParameters private DocumentLibraryParameters documentLibraryParameters; private SharePointPageAndListParameters sharePointPageAndListParameters; private CustomParameters customParameters; + public object GetDynamicParameters() { switch (Type) @@ -43,6 +44,7 @@ public object GetDynamicParameters() return officeFileParameters; } case TeamTabType.DocumentLibrary: + case TeamTabType.Planner: case TeamTabType.WebSite: { documentLibraryParameters = new DocumentLibraryParameters(); @@ -50,7 +52,7 @@ public object GetDynamicParameters() } case TeamTabType.SharePointPageAndList: { - sharePointPageAndListParameters= new SharePointPageAndListParameters(); + sharePointPageAndListParameters = new SharePointPageAndListParameters(); return sharePointPageAndListParameters; } case TeamTabType.Custom: @@ -90,6 +92,7 @@ protected override void ExecuteCmdlet() break; } case TeamTabType.DocumentLibrary: + case TeamTabType.Planner: case TeamTabType.WebSite: { EnsureDynamicParameters(documentLibraryParameters); diff --git a/src/Commands/Utilities/TeamsUtility.cs b/src/Commands/Utilities/TeamsUtility.cs index 74bd1efc4..0aef08361 100644 --- a/src/Commands/Utilities/TeamsUtility.cs +++ b/src/Commands/Utilities/TeamsUtility.cs @@ -908,6 +908,8 @@ public static async Task AddTabAsync(PnPConnection connection, string a case TeamTabType.Planner: { tab.TeamsAppId = "com.microsoft.teamspace.tab.planner"; + tab.Configuration = new TeamTabConfiguration(); + tab.Configuration.ContentUrl = contentUrl; break; } case TeamTabType.MicrosoftStream: