From 2ec393a2f6952ad564aec52f4dfb1b758681b1e8 Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Thu, 2 Feb 2023 05:25:14 +0000 Subject: [PATCH 1/5] Adding option to set VivaConnectionsDefaultStart --- src/Commands/Admin/SetHomeSite.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Commands/Admin/SetHomeSite.cs b/src/Commands/Admin/SetHomeSite.cs index aaf54dd05..db269c584 100644 --- a/src/Commands/Admin/SetHomeSite.cs +++ b/src/Commands/Admin/SetHomeSite.cs @@ -12,10 +12,21 @@ public class SetHomeSite : PnPAdminCmdlet [Parameter(Mandatory = true)] public string HomeSiteUrl; + [Parameter(Mandatory = false)] + public SwitchParameter VivaConnectionsDefaultStart; + protected override void ExecuteCmdlet() { - Tenant.SetSPHSite(HomeSiteUrl); - ClientContext.ExecuteQueryRetry(); + if (ParameterSpecified(nameof(VivaConnectionsDefaultStart))) + { + Tenant.SetSPHSiteWithConfigurations(HomeSiteUrl,VivaConnectionsDefaultStart); + ClientContext.ExecuteQueryRetry(); + } + else + { + Tenant.SetSPHSite(HomeSiteUrl); + ClientContext.ExecuteQueryRetry(); + } } } } \ No newline at end of file From d537cc1c7c1ca417d38d66544d7ae9ea84f6d551 Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Thu, 2 Feb 2023 07:18:33 +0000 Subject: [PATCH 2/5] Amend switchParameter to bool to allow setting VivaConnectionsDefaultStart on and off --- src/Commands/Admin/SetHomeSite.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/Admin/SetHomeSite.cs b/src/Commands/Admin/SetHomeSite.cs index db269c584..491b62428 100644 --- a/src/Commands/Admin/SetHomeSite.cs +++ b/src/Commands/Admin/SetHomeSite.cs @@ -13,13 +13,13 @@ public class SetHomeSite : PnPAdminCmdlet public string HomeSiteUrl; [Parameter(Mandatory = false)] - public SwitchParameter VivaConnectionsDefaultStart; + public bool VivaConnectionsDefaultStart; protected override void ExecuteCmdlet() { if (ParameterSpecified(nameof(VivaConnectionsDefaultStart))) { - Tenant.SetSPHSiteWithConfigurations(HomeSiteUrl,VivaConnectionsDefaultStart); + Tenant.SetSPHSiteWithConfigurations(HomeSiteUrl, VivaConnectionsDefaultStart); ClientContext.ExecuteQueryRetry(); } else From 8b9f235fa9f019dcd9c7bf683ed3aa6d66352502 Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Thu, 2 Feb 2023 08:01:11 +0000 Subject: [PATCH 3/5] Amended docs and code --- documentation/Set-PnPHomeSite.md | 14 ++++++++++++++ src/Commands/Admin/SetHomeSite.cs | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/documentation/Set-PnPHomeSite.md b/documentation/Set-PnPHomeSite.md index 2e2fa8211..fb5ee6c86 100644 --- a/documentation/Set-PnPHomeSite.md +++ b/documentation/Set-PnPHomeSite.md @@ -66,7 +66,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -VivaConnectionsDefaultStart +When set to $true, the VivaConnectionsDefaultStart parameter will keep the Viva Connections landing experience to the SharePoint home site. If set to $false the Viva Connections home experience will be used. + +```yaml +Type: Boolean +Parameter Sets: Set Properties +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) [Set up a home site for your organization](https://learn.microsoft.com/sharepoint/home-site) +[Customize and edit the Viva Connections home experience](https://learn.microsoft.com/en-us/viva/connections/edit-viva-home) diff --git a/src/Commands/Admin/SetHomeSite.cs b/src/Commands/Admin/SetHomeSite.cs index 491b62428..c363d32de 100644 --- a/src/Commands/Admin/SetHomeSite.cs +++ b/src/Commands/Admin/SetHomeSite.cs @@ -20,13 +20,12 @@ protected override void ExecuteCmdlet() if (ParameterSpecified(nameof(VivaConnectionsDefaultStart))) { Tenant.SetSPHSiteWithConfigurations(HomeSiteUrl, VivaConnectionsDefaultStart); - ClientContext.ExecuteQueryRetry(); } else { Tenant.SetSPHSite(HomeSiteUrl); - ClientContext.ExecuteQueryRetry(); } + ClientContext.ExecuteQueryRetry(); } } } \ No newline at end of file From e61054f5b9927b89b4c4eb84870b725c4510fc40 Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Thu, 2 Feb 2023 08:02:06 +0000 Subject: [PATCH 4/5] Amended docs --- documentation/Set-PnPHomeSite.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/documentation/Set-PnPHomeSite.md b/documentation/Set-PnPHomeSite.md index fb5ee6c86..3b63d93ce 100644 --- a/documentation/Set-PnPHomeSite.md +++ b/documentation/Set-PnPHomeSite.md @@ -36,6 +36,13 @@ Set-PnPHomeSite -HomeSiteUrl "https://yourtenant.sharepoint.com/sites/myhome" Sets the home site to the provided site collection url +### EXAMPLE 2 +```powershell +Set-PnPHomeSite -HomeSiteUrl "https://yourtenant.sharepoint.com/sites/myhome" -VivaConnectionsDefaultStart $true +``` + +Sets the home site to the provided site collection url and keeps the Viva Connections landing experience to the SharePoint home site. + ## PARAMETERS ### -Connection From 8bbb1119212956927562a745fd6d0fd3f76e6b61 Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Mon, 6 Feb 2023 16:48:42 +0000 Subject: [PATCH 5/5] Update to code to revert to switch parameter and add option to retrieve the value back --- documentation/Get-PnPHomeSite.md | 20 ++++++++++++++++++++ documentation/Set-PnPHomeSite.md | 6 +++--- src/Commands/Admin/GetHomeSite.cs | 22 ++++++++++++++++++---- src/Commands/Admin/SetHomeSite.cs | 2 +- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/documentation/Get-PnPHomeSite.md b/documentation/Get-PnPHomeSite.md index 51a4c9aae..53a308ece 100644 --- a/documentation/Get-PnPHomeSite.md +++ b/documentation/Get-PnPHomeSite.md @@ -34,6 +34,13 @@ Get-PnPHomeSite Returns the home site url for your tenant +### EXAMPLE 2 +```powershell +Get-PnPHomeSite -IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled +``` + +Returns whether Viva Connections landing experience is set to the SharePoint home site. + ## PARAMETERS ### -Connection @@ -50,6 +57,19 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled +When specified, it retrieves whether Viva Connections landing experience is set to the SharePoint home site. + +```yaml +Type: Boolean +Parameter Sets: (All) +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ## RELATED LINKS [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) diff --git a/documentation/Set-PnPHomeSite.md b/documentation/Set-PnPHomeSite.md index 3b63d93ce..db0f5e4e5 100644 --- a/documentation/Set-PnPHomeSite.md +++ b/documentation/Set-PnPHomeSite.md @@ -38,7 +38,7 @@ Sets the home site to the provided site collection url ### EXAMPLE 2 ```powershell -Set-PnPHomeSite -HomeSiteUrl "https://yourtenant.sharepoint.com/sites/myhome" -VivaConnectionsDefaultStart $true +Set-PnPHomeSite -HomeSiteUrl "https://yourtenant.sharepoint.com/sites/myhome" -VivaConnectionsDefaultStart:$true ``` Sets the home site to the provided site collection url and keeps the Viva Connections landing experience to the SharePoint home site. @@ -78,10 +78,10 @@ When set to $true, the VivaConnectionsDefaultStart parameter will keep the Viva ```yaml Type: Boolean -Parameter Sets: Set Properties +Parameter Sets: (All) Required: False Position: Named -Default value: False +Default value: true Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/src/Commands/Admin/GetHomeSite.cs b/src/Commands/Admin/GetHomeSite.cs index a13df9d9d..38188abda 100644 --- a/src/Commands/Admin/GetHomeSite.cs +++ b/src/Commands/Admin/GetHomeSite.cs @@ -1,4 +1,5 @@ -using Microsoft.SharePoint.Client; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.SharePoint.Client; using PnP.PowerShell.Commands.Base; using System.Management.Automation; @@ -8,11 +9,24 @@ namespace PnP.PowerShell.Commands.Admin [Cmdlet(VerbsCommon.Get, "PnPHomeSite")] public class GetHomeSite : PnPAdminCmdlet { + [Parameter(Mandatory = false)] + public SwitchParameter IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled; protected override void ExecuteCmdlet() { - var results = Tenant.GetSPHSiteUrl(); - ClientContext.ExecuteQueryRetry(); - WriteObject(results.Value); + if (ParameterSpecified(nameof(IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled))) + { + var results = Tenant.IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled(); + ClientContext.ExecuteQueryRetry(); + WriteObject(results.Value); + } + else + { + var results = Tenant.GetSPHSiteUrl(); + ClientContext.ExecuteQueryRetry(); + WriteObject(results.Value); + } + + } } } \ No newline at end of file diff --git a/src/Commands/Admin/SetHomeSite.cs b/src/Commands/Admin/SetHomeSite.cs index c363d32de..e0f3d1c01 100644 --- a/src/Commands/Admin/SetHomeSite.cs +++ b/src/Commands/Admin/SetHomeSite.cs @@ -13,7 +13,7 @@ public class SetHomeSite : PnPAdminCmdlet public string HomeSiteUrl; [Parameter(Mandatory = false)] - public bool VivaConnectionsDefaultStart; + public SwitchParameter VivaConnectionsDefaultStart; protected override void ExecuteCmdlet() {