File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Extensions
CippExtensions/Public/Sherweb Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ Function Invoke-ExecExtensionMapping {
35
35
' HuduFields' {
36
36
$Body = Get-HuduFieldMapping - CIPPMapping $Table
37
37
}
38
+ ' Sherweb' {
39
+ $Body = Get-SherwebMapping - CIPPMapping $Table
40
+ }
38
41
}
39
42
}
40
43
Original file line number Diff line number Diff line change
1
+ function Get-SherwebMapping {
2
+ [CmdletBinding ()]
3
+ param (
4
+ $CIPPMapping
5
+ )
6
+
7
+ $ExtensionMappings = Get-ExtensionMapping - Extension ' Sherweb'
8
+
9
+ $Tenants = Get-Tenants - IncludeErrors
10
+
11
+ $Mappings = foreach ($Mapping in $ExtensionMappings ) {
12
+ $Tenant = $Tenants | Where-Object { $_.RowKey -eq $Mapping.RowKey }
13
+ if ($Tenant ) {
14
+ [PSCustomObject ]@ {
15
+ TenantId = $Tenant.customerId
16
+ Tenant = $Tenant.displayName
17
+ TenantDomain = $Tenant.defaultDomainName
18
+ IntegrationId = $Mapping.IntegrationId
19
+ IntegrationName = $Mapping.IntegrationName
20
+ }
21
+ }
22
+ }
23
+ $Tenants = Get-Tenants - IncludeErrors
24
+ try {
25
+ $SherwebCustomers = Get-SherwebCustomers
26
+
27
+ } catch {
28
+ $Message = if ($_.ErrorDetails.Message ) {
29
+ Get-NormalizedError - Message $_.ErrorDetails.Message
30
+ } else {
31
+ $_.Exception.message
32
+ }
33
+
34
+ Write-LogMessage - Message " Could not get Sherweb Companies, error: $Message " - Level Error - tenant ' CIPP' - API ' SherwebMapping'
35
+ $SherwebCustomers = @ (@ {name = " Could not get Sherweb Companies, error: $Message " ; value = ' -1' })
36
+ }
37
+ $SherwebCustomers = $SherwebCustomers | ForEach-Object {
38
+ [PSCustomObject ]@ {
39
+ name = $_.displayName
40
+ value = " $ ( $_.id ) "
41
+ }
42
+ }
43
+ $MappingObj = [PSCustomObject ]@ {
44
+ Companies = @ ($SherwebCustomers )
45
+ Mappings = $Mappings
46
+ }
47
+
48
+ return $MappingObj
49
+
50
+ }
You can’t perform that action at this time.
0 commit comments