Skip to content

Commit

Permalink
code updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jformacek committed Mar 7, 2024
1 parent c6eea05 commit 9fe9752
Show file tree
Hide file tree
Showing 2 changed files with 39 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.1.2'
ModuleVersion = '1.1.3'

# Supported PSEditions
CompatiblePSEditions = @('Desktop', 'Core')
Expand Down
40 changes: 38 additions & 2 deletions Module/ExoHelper/ExoHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ This command retrieves mailbox of user JohnDoe and returns just netId property
#If we want to write any warnings returned by EXO REST API
$ShowWarnings,

[switch]
#If we want to remove odata type descriptor properties from the output
$RemoveOdataProperties,

[switch]
#If we want to include rate limits reported by REST API to verbose output
$ShowRateLimits,
Expand All @@ -161,7 +165,7 @@ This command retrieves mailbox of user JohnDoe and returns just netId property
begin
{
$body = @{}
$batchSize = 1000
$batchSize = 100
$uri = $Connection.ConnectionUri
if($PropertiesToLoad.Count -gt 0)
{
Expand Down Expand Up @@ -241,7 +245,13 @@ This command retrieves mailbox of user JohnDoe and returns just netId property
}
}
$resultsRetrieved+=$responseData.value.Count
$responseData.value
if($RemoveOdataProperties)
{
$responseData.value | RemoveExoOdataProperties
}
else {
$responseData.value
}
$pageUri = $responseData.'@odata.nextLink'
}
catch {
Expand Down Expand Up @@ -323,3 +333,29 @@ This command retrieves mailbox of user JohnDoe and returns just netId property
$progressPreference = $pref
}
}

function RemoveExoOdataProperties
{
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline)]
[PSCustomObject]
$Object
)
begin
{
$propsToRemove = $null
}
process
{
if($null -eq $propsToRemove)
{
$propsToRemove = $Object.PSObject.Properties | Where-Object { $_.Name.IndexOf('@') -ge 0 }
}
foreach($prop in $propsToRemove)
{
$Object.PSObject.Properties.Remove($prop.Name)
}
$Object
}
}

0 comments on commit 9fe9752

Please sign in to comment.