Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions src/Commands/Admin/GetHomeSite.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Model.SharePoint;
using System.Management.Automation;

namespace PnP.PowerShell.Commands.Admin
Expand All @@ -18,14 +19,16 @@ public class GetHomeSite : PnPAdminCmdlet

protected override void ExecuteCmdlet()
{
if(Detailed.ToBool())
if (Detailed.ToBool())
{
var results = Tenant.GetHomeSitesDetails();
var results = Tenant.GetHomeSitesDetails();
AdminContext.ExecuteQueryRetry();
WriteObject(results, true);
}
else
{


if (IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled)
{
var results = Tenant.IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled();
Expand All @@ -34,9 +37,32 @@ protected override void ExecuteCmdlet()
}
else
{
Tenant.EnsureProperties(t => t.IsMultipleVivaConnectionsFlightEnabled, t => t.IsVivaHomeFlightEnabled);

var results = Tenant.GetSPHSiteUrl();
AdminContext.ExecuteQueryRetry();
WriteObject(results.Value);

if (Tenant.IsVivaHomeFlightEnabled)
{
if (results != null && !string.IsNullOrEmpty(results.Value))
{
var isDraftModeForCompanyPortalEnabled = Tenant.IsDraftModeForCompanyPortalSiteEnabled();
var isVivaConnsDefaultStartForCompanyPortalEnabled = Tenant.IsVivaConnectionsDefaultStartForCompanyPortalSiteEnabled();
AdminContext.ExecuteQueryRetry();

CompanyPortalSiteDetails companyPortalSiteDetails = new()
{
HomeSiteUrl = results.Value,
DraftMode = isDraftModeForCompanyPortalEnabled.Value,
VivaConnectionsDefaultStart = isVivaConnsDefaultStartForCompanyPortalEnabled.Value
};
WriteObject(companyPortalSiteDetails);
}
}
else
{
WriteObject(results.Value);
}
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/Commands/Model/SharePoint/CompanyPortalSiteDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PnP.PowerShell.Commands.Model.SharePoint
{
public class CompanyPortalSiteDetails
{
public string HomeSiteUrl { get; set; }

public bool DraftMode { get; set; }

public bool VivaConnectionsDefaultStart { get; set; }
}
}