Skip to content

Commit

Permalink
Ensuring sitecol access to PP Url
Browse files Browse the repository at this point in the history
  • Loading branch information
tarjeieo committed Nov 26, 2024
1 parent 582fcd8 commit e243543
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Install/Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ if (-not $SkipSiteDesign.IsPresent) {
StartAction("Creating/updating site design $SiteDesignName")
Connect-SharePoint -Url $AdminSiteUrl -ConnectionInfo $ConnectionInfo

$NoOutput = Get-PnpSiteDesign | Where-Object {$_.Title.Contains("Prosjektområde - test")} | Remove-PnPSiteDesign -Force -ErrorAction SilentlyContinue
$NoOutput = Get-PnpSiteDesign | Where-Object { $_.Title.Contains("Prosjektområde - test") } | Remove-PnPSiteDesign -Force -ErrorAction SilentlyContinue

$SiteDesign = Get-PnPSiteDesign -Identity $SiteDesignName

Expand Down Expand Up @@ -266,6 +266,21 @@ if (-not $SkipDefaultSiteDesignAssociation.IsPresent) {
}
EndAction
}

try {
StartAction("Ensuring site collection administrator access to $Url")
$UserName = $CurrentUser.LoginName

Connect-SharePoint -Url $AdminSiteUrl -ConnectionInfo $ConnectionInfo
Set-PnPTenantSite -Url $Url -Owners $UserName -ErrorAction SilentlyContinue
}
catch {
Write-Host "Failed to get current user. Unable to ensure access to $Url." -ForegroundColor Yellow
}
finally {
EndAction
}

#endregion

#region Running pre-install upgrade steps
Expand Down

0 comments on commit e243543

Please sign in to comment.