HubSite¶
- What is a SharePoint hub site
- Video - SharePoint hub sites — What intranet managers need to know
- spsnyc-how-hub-sites-raise-sharepoints-intranet-potential
- the-intranet-managers-guide-to-office-365-sharepoint-hub-sites
- common-use-cases-for-office-365-sharepoint-hub-sites
- architecture-considerations-and-quick-reference-tips-for-office-365s-sharepoint-hub-sites
- How to Create Hub Sites in SharePoint Online
Planning¶
Integration¶
- sharepoint-hub-sites-make-their-debut
- Organize-your-intranet-with-SharePoint-hub-sites
- Planning your SharePoint hub sites
Navigation¶
- Security Trimmed Hub Site Navigation Updates!
- security-trimmed-hub-navigation
- manage-sharepoint-communication-sites-megamenu-with-csom-and-powershell
- 6 tips to get mega value from the new megamenu navigation for SharePoint
Tips¶
-Introducing the idea of Archive Hub Sites - How to get the hubId in SharePoint Framework - Fix broken Hub Sites in SharePoint Online
cls
$tenantAdmin = "https://contoso-admin.sharepoint.com"
$hubSite = "https://contoso.sharepoint.com/sites/hub"
$extensionGUID = "6da1a9e8-471d-4f39-80e6-a7ded02e8881"
$extensionName = "Extension Name"
$extensionTitle = "Extension Title"
try
{
Connect-PnPOnline -Url $tenantAdmin -UseWebLogin
} catch {
Write-Host "Unable to connect."
exit
}
$HubSite = Get-PnPHubSite $hubSite
$HubSiteId = $HubSite.SiteId
$ModernSites = (Get-PnPTenantSite -Template 'GROUP#0') + (Get-PnPTenantSite -Template 'SITEPAGEPUBLISHING#0')
$SitesFromHub = New-Object System.Collections.ArrayList
Write-Host ("Searching {0} sites:" -f $HubSite.Title) -BackgroundColor Gray
foreach ($ModernSite in $ModernSites){
$site = Get-PnPHubSite $ModernSite.Url
if($site.SiteUrl){
if($site.SiteId -eq $HubSiteId){
Write-Host ("* {0} - {1}" -f $ModernSite.Title, $ModernSite.Url)
$SitesFromHub.Add($ModernSite) | Out-Null
}
}
}
Write-Host ""
Write-Host "Installing at:" -BackgroundColor Gray
foreach ($SiteHub in $SitesFromHub){
Write-Host ("* {0} - {1} ... " -f $SiteHub.Title, $SiteHub.Url) -NoNewline
Connect-PnPOnline -Url $SiteHub.Url -UseWebLogin
Add-PnPCustomAction -ClientSideComponentId $extensionGUID -Name $extensionName -Title $extensionTitle -Location ClientSideExtension.ApplicationCustomizer -Scope site
Write-Host "Done" -BackgroundColor Green
Disconnect-PnPOnline
}
Write-Host "All Done"
CSOM¶
Search API¶
# List all sites being a hub site or associate to a hub site
$results = Submit-PnPSearchQuery -Query 'contentclass=sts_site' -RefinementFilters 'departmentid:string("{*",linguistics=off)' -TrimDuplicates $false -SelectProperties @("Title","Path","DepartmentId","SiteId") -All -RelevantResults
# Filter out the hub sites
$hubSites = $results |? { $_.DepartmentId.Trim('{','}') -eq $_.SiteId }
# Loop over the hub sites
foreach( $hub in $hubSites ) {
Write-Host $hub.Title - $hub.Path -ForegroundColor Green
# Filter out sites associated to the current hub
$associatedSites = ($results |? { $_.DepartmentId -eq $hub.DepartmentId -and $_.SiteId -ne $hub.SiteId })
foreach($site in $associatedSites) {
Write-Host "`t"$site.Title - $site.Path -ForegroundColor Yellow
}
}