Skip to content

Commit

Permalink
fix: PS Desktop without IE
Browse files Browse the repository at this point in the history
  • Loading branch information
jformacek committed Feb 4, 2024
1 parent 8867fae commit cdea456
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Module/ExoHelper/ExoHelper.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'ExoHelper.psm1'

# Version number of this module.
ModuleVersion = '1.0.4'
ModuleVersion = '1.0.5'

# Supported PSEditions
CompatiblePSEditions = @('Desktop', 'Core')
Expand Down
21 changes: 19 additions & 2 deletions Module/ExoHelper/ExoHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,25 @@ This command retrieves mailbox of user JohnDoe and returns just netId property
#provide up to date token for each request of commands returning paged results that may take long to complete
$headers['Authorization'] = (Get-ExoToken).CreateAuthorizationHeader()
Write-Verbose "RequestId: $($headers['client-request-id'])`tUri: $pageUri"

$response = Invoke-WebRequest -Uri $pageUri -Method Post -Body ($body | ConvertTo-Json -Depth 9) -Headers $headers -ContentType 'application/json' -ErrorAction Stop -Verbose:$false
$splat = @{
Uri = $pageUri
Method = 'Post'
Body = ($body | ConvertTo-Json -Depth 9)
Headers = $headers
ContentType = 'application/json'
ErrorAction = 'Stop'
Verbose = $false
}
#add edition-specific parameters
if($PSEdition -eq 'Desktop')
{
$splat['UseBasicParsing'] = $true
}
else
{
$splat['ProgressAction'] = 'SilentlyContinue'
}
$response = Invoke-WebRequest @splat
#we may process the headers in the future to see rate limit remaining, etc.
$responseHeaders = $response.Headers

Expand Down

0 comments on commit cdea456

Please sign in to comment.