Skip to content

Commit 9487b8c

Browse files
committed
fix list sherweb mapping
1 parent 56408ef commit 9487b8c

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Modules/CippExtensions/Public/Sherweb/Get-SherwebMapping.ps1

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ function Get-SherwebMapping {
77
$ExtensionMappings = Get-ExtensionMapping -Extension 'Sherweb'
88

99
$Tenants = Get-Tenants -IncludeErrors
10-
1110
$Mappings = foreach ($Mapping in $ExtensionMappings) {
12-
$Tenant = $Tenants | Where-Object { $_.defaultDomainName -eq $Mapping.RowKey }
11+
$Tenant = $Tenants | Where-Object { $_.customerId -eq $Mapping.RowKey }
1312
if ($Tenant) {
1413
[PSCustomObject]@{
1514
TenantId = $Tenant.customerId
@@ -20,10 +19,13 @@ function Get-SherwebMapping {
2019
}
2120
}
2221
}
23-
$Tenants = Get-Tenants -IncludeErrors
2422
try {
25-
$SherwebCustomers = Get-SherwebCustomers
26-
23+
$SherwebCustomers = Get-SherwebCustomers | ForEach-Object {
24+
[PSCustomObject]@{
25+
name = $_.displayName
26+
value = "$($_.id)"
27+
}
28+
}
2729
} catch {
2830
$Message = if ($_.ErrorDetails.Message) {
2931
Get-NormalizedError -Message $_.ErrorDetails.Message
@@ -34,12 +36,7 @@ function Get-SherwebMapping {
3436
Write-LogMessage -Message "Could not get Sherweb Companies, error: $Message " -Level Error -tenant 'CIPP' -API 'SherwebMapping'
3537
$SherwebCustomers = @(@{name = "Could not get Sherweb Companies, error: $Message"; value = '-1' })
3638
}
37-
$SherwebCustomers = $SherwebCustomers | ForEach-Object {
38-
[PSCustomObject]@{
39-
name = $_.displayName
40-
value = "$($_.id)"
41-
}
42-
}
39+
4340
$MappingObj = [PSCustomObject]@{
4441
Companies = @($SherwebCustomers)
4542
Mappings = @($Mappings)

0 commit comments

Comments
 (0)