From 1a447fee8acb36ca1eb6623b6924778f72b30ce7 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Sat, 13 Jun 2026 17:34:32 +0300 Subject: [PATCH 1/2] Update documentation and error handling for Viva Connections Dashboard ACE commands to reflect support for Team and Communication sites --- .../Add-PnPVivaConnectionsDashboardACE.md | 4 ++-- .../Get-PnPVivaConnectionsDashboardACE.md | 2 +- .../Remove-PnPVivaConnectionsDashboardACE.md | 2 +- .../Set-PnPVivaConnectionsDashboardACE.md | 2 +- .../Viva/AddVivaConnectionsDashboardACE.cs | 7 +++--- .../Viva/GetVivaConnectionsDashboardACE.cs | 23 +++++++------------ .../Viva/RemoveVivaConnectionsDashboardACE.cs | 9 ++++---- .../Viva/SetVivaConnectionsDashboardACE.cs | 9 +++----- 8 files changed, 23 insertions(+), 35 deletions(-) diff --git a/documentation/Add-PnPVivaConnectionsDashboardACE.md b/documentation/Add-PnPVivaConnectionsDashboardACE.md index 6509dade3c..db27f8cf6c 100644 --- a/documentation/Add-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Add-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Add-PnPVivaConnectionsD # Add-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Add an Adaptive card extension in the Viva connections dashboard page. This requires that you connect to a SharePoint Home site and have configured the Viva connections page. +Add an Adaptive card extension in the Viva connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva connections page. ## SYNTAX @@ -20,7 +20,7 @@ Add-PnPVivaConnectionsDashboardACE [-Identity ] [-Title ] [- ## DESCRIPTION -Allows to add a new an Adaptive card extension in the Viva Home dashboard page. Before running the command it is required you are connect to a SharePoint Home site and have configured the Viva connections page. +Allows to add a new an Adaptive card extension in the Viva Home dashboard page. Before running the command it is required you are connected to a SharePoint Team or Communication site and have configured the Viva connections page. ## EXAMPLES diff --git a/documentation/Get-PnPVivaConnectionsDashboardACE.md b/documentation/Get-PnPVivaConnectionsDashboardACE.md index fe702c523a..600f7134f0 100644 --- a/documentation/Get-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Get-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Get-PnPVivaConnectionsD # Get-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Returns the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Home site and have configured the Viva connections page. +Returns the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva connections page. ## SYNTAX diff --git a/documentation/Remove-PnPVivaConnectionsDashboardACE.md b/documentation/Remove-PnPVivaConnectionsDashboardACE.md index ff55d59f31..ac07e47713 100644 --- a/documentation/Remove-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Remove-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPVivaConnectio # Remove-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Removes the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Home site and have configured the Viva connections page. +Removes the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva connections page. ## SYNTAX diff --git a/documentation/Set-PnPVivaConnectionsDashboardACE.md b/documentation/Set-PnPVivaConnectionsDashboardACE.md index bafe60c283..ee4caacaef 100644 --- a/documentation/Set-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Set-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Update-PnPVivaConnectio # Set-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Update the Adaptive card extension in the Viva Connections dashboard page. This requires that you connect to a SharePoint Home site and have configured the Viva Connections page. +Update the Adaptive card extension in the Viva Connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva Connections page. ## SYNTAX diff --git a/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs b/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs index ca3b1eec94..484b5db7d6 100644 --- a/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs @@ -32,10 +32,9 @@ public class AddVivaConnectionsDashboardACE : PnPWebCmdlet protected override void ExecuteCmdlet() { var pnpContext = Connection.PnPContext; - if (pnpContext.Site.IsHomeSite()) + IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); + if (dashboard != null) { - IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); - var cardDesignerACE = dashboard.NewACE(Identity, CardSize); cardDesignerACE.Title = Title; if (ParameterSpecified(nameof(PropertiesJSON))) @@ -70,7 +69,7 @@ protected override void ExecuteCmdlet() } else { - LogWarning("Connected site is not a home site"); + LogError("Dashboard not found"); } } } diff --git a/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs b/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs index c2d2033b9a..f93ed43bfd 100644 --- a/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs @@ -13,30 +13,23 @@ public class GetVivaConnectionsDashboard : PnPWebCmdlet protected override void ExecuteCmdlet() { var pnpContext = Connection.PnPContext; - if (pnpContext.Site.IsHomeSite()) - { - IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); - if (ParameterSpecified(nameof(Identity))) + IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); + if (ParameterSpecified(nameof(Identity))) + { + var aceToRetrieve = Identity.GetACE(dashboard, this); + if (aceToRetrieve != null) { - var aceToRetrieve = Identity.GetACE(dashboard, this); - if (aceToRetrieve != null) - { - WriteObject(aceToRetrieve); - } - else - { - LogWarning("ACE with specified identifier not found"); - } + WriteObject(aceToRetrieve); } else { - WriteObject(dashboard.ACEs, true); + LogWarning("ACE with specified identifier not found"); } } else { - LogWarning("Connected site is not a home site"); + WriteObject(dashboard?.ACEs, true); } } } diff --git a/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs b/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs index 28e175c265..102368368e 100644 --- a/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs @@ -13,11 +13,10 @@ public class RemoveVivaConnectionsACE : PnPWebCmdlet protected override void ExecuteCmdlet() { var pnpContext = Connection.PnPContext; - if (pnpContext.Site.IsHomeSite()) + IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); + if (dashboard != null) { - IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); var aceToRemove = Identity.GetACE(dashboard, this); - if (aceToRemove != null) { dashboard.RemoveACE(aceToRemove.InstanceId); @@ -30,8 +29,8 @@ protected override void ExecuteCmdlet() } else { - LogWarning("Connected site is not a home site"); + LogError("Dashboard not found"); } } } -} +} \ No newline at end of file diff --git a/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs b/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs index 8b836644d8..80c97f56a6 100644 --- a/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs @@ -46,12 +46,10 @@ public class SetVivaConnectionsACE : PnPWebCmdlet protected override void ExecuteCmdlet() { var pnpContext = Connection.PnPContext; - if (pnpContext.Site.IsHomeSite()) + IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); + if (dashboard != null) { - IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); - var aceToUpdate = Identity.GetACE(dashboard, this); - if (aceToUpdate != null) { bool updateRequired = false; @@ -105,7 +103,6 @@ protected override void ExecuteCmdlet() } dashboard.Save(); - dashboard = pnpContext.Web.GetVivaDashboard(); WriteObject(dashboard, true); } @@ -117,7 +114,7 @@ protected override void ExecuteCmdlet() } else { - LogWarning("Connected site is not a home site"); + LogError("Dashboard not found"); } } } From aa9d85e926566a6eb1dd0f2d513205a8698de086 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Sat, 13 Jun 2026 17:48:03 +0300 Subject: [PATCH 2/2] Update documentation and error messages for Viva Connections Dashboard ACE commands to specify SharePoint Team site requirement --- documentation/Add-PnPVivaConnectionsDashboardACE.md | 4 ++-- documentation/Get-PnPVivaConnectionsDashboardACE.md | 2 +- documentation/Remove-PnPVivaConnectionsDashboardACE.md | 2 +- documentation/Set-PnPVivaConnectionsDashboardACE.md | 2 +- src/Commands/Viva/AddVivaConnectionsDashboardACE.cs | 2 +- src/Commands/Viva/GetVivaConnectionsDashboardACE.cs | 8 +++++++- src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs | 2 +- src/Commands/Viva/SetVivaConnectionsDashboardACE.cs | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/documentation/Add-PnPVivaConnectionsDashboardACE.md b/documentation/Add-PnPVivaConnectionsDashboardACE.md index db27f8cf6c..25a728d8a0 100644 --- a/documentation/Add-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Add-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Add-PnPVivaConnectionsD # Add-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Add an Adaptive card extension in the Viva connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva connections page. +Add an Adaptive card extension in the Viva connections dashboard page. This requires that you connect to a SharePoint Team site or Communication site and have configured the Viva connections page. ## SYNTAX @@ -20,7 +20,7 @@ Add-PnPVivaConnectionsDashboardACE [-Identity ] [-Title ] [- ## DESCRIPTION -Allows to add a new an Adaptive card extension in the Viva Home dashboard page. Before running the command it is required you are connected to a SharePoint Team or Communication site and have configured the Viva connections page. +Allows you to add a new Adaptive card extension in the Viva Connections dashboard page. Before running the command, you must be connected to a SharePoint Team site or Communication site and have configured the Viva connections page. ## EXAMPLES diff --git a/documentation/Get-PnPVivaConnectionsDashboardACE.md b/documentation/Get-PnPVivaConnectionsDashboardACE.md index 600f7134f0..e557c300df 100644 --- a/documentation/Get-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Get-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Get-PnPVivaConnectionsD # Get-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Returns the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva connections page. +Returns the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Team site or Communication site and have configured the Viva connections page. ## SYNTAX diff --git a/documentation/Remove-PnPVivaConnectionsDashboardACE.md b/documentation/Remove-PnPVivaConnectionsDashboardACE.md index ac07e47713..13005a3eb4 100644 --- a/documentation/Remove-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Remove-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Remove-PnPVivaConnectio # Remove-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Removes the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva connections page. +Removes the Adaptive card extensions from the Viva connections dashboard page. This requires that you connect to a SharePoint Team site or Communication site and have configured the Viva connections page. ## SYNTAX diff --git a/documentation/Set-PnPVivaConnectionsDashboardACE.md b/documentation/Set-PnPVivaConnectionsDashboardACE.md index ee4caacaef..8f89bd277b 100644 --- a/documentation/Set-PnPVivaConnectionsDashboardACE.md +++ b/documentation/Set-PnPVivaConnectionsDashboardACE.md @@ -10,7 +10,7 @@ online version: https://pnp.github.io/powershell/cmdlets/Update-PnPVivaConnectio # Set-PnPVivaConnectionsDashboardACE ## SYNOPSIS -Update the Adaptive card extension in the Viva Connections dashboard page. This requires that you connect to a SharePoint Team or Communication site and have configured the Viva Connections page. +Update the Adaptive card extension in the Viva Connections dashboard page. This requires that you connect to a SharePoint Team site or Communication site and have configured the Viva Connections page. ## SYNTAX diff --git a/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs b/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs index 484b5db7d6..0ec44b7c74 100644 --- a/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/AddVivaConnectionsDashboardACE.cs @@ -69,7 +69,7 @@ protected override void ExecuteCmdlet() } else { - LogError("Dashboard not found"); + LogError("Viva Connections dashboard not found. Create or configure the Viva Connections dashboard page (Dashboard.aspx) on the connected SharePoint Team site or Communication site."); } } } diff --git a/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs b/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs index f93ed43bfd..7901994a39 100644 --- a/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/GetVivaConnectionsDashboardACE.cs @@ -15,6 +15,12 @@ protected override void ExecuteCmdlet() var pnpContext = Connection.PnPContext; IVivaDashboard dashboard = pnpContext.Web.GetVivaDashboard(); + if (dashboard == null) + { + LogError("Viva Connections dashboard not found. Create or configure the Viva Connections dashboard page (Dashboard.aspx) on the connected SharePoint Team site or Communication site."); + return; + } + if (ParameterSpecified(nameof(Identity))) { var aceToRetrieve = Identity.GetACE(dashboard, this); @@ -29,7 +35,7 @@ protected override void ExecuteCmdlet() } else { - WriteObject(dashboard?.ACEs, true); + WriteObject(dashboard.ACEs, true); } } } diff --git a/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs b/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs index 102368368e..958a2dc3be 100644 --- a/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/RemoveVivaConnectionsDashboardACE.cs @@ -29,7 +29,7 @@ protected override void ExecuteCmdlet() } else { - LogError("Dashboard not found"); + LogError("Viva Connections dashboard not found. Create or configure the Viva Connections dashboard page (Dashboard.aspx) on the connected SharePoint Team site or Communication site."); } } } diff --git a/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs b/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs index 80c97f56a6..ff4c836e54 100644 --- a/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs +++ b/src/Commands/Viva/SetVivaConnectionsDashboardACE.cs @@ -114,7 +114,7 @@ protected override void ExecuteCmdlet() } else { - LogError("Dashboard not found"); + LogError("Viva Connections dashboard not found. Create or configure the Viva Connections dashboard page (Dashboard.aspx) on the connected SharePoint Team site or Communication site."); } } }