Skip to content

Commit

Permalink
code updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jformacek committed Apr 9, 2024
1 parent e66a692 commit 0ca0ba5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
4 changes: 2 additions & 2 deletions 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.5'
ModuleVersion = '2.0.0'

# Supported PSEditions
CompatiblePSEditions = @('Desktop', 'Core')
Expand Down Expand Up @@ -69,7 +69,7 @@ RequiredModules = @('AadAuthenticationFactory')
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @('New-ExoConnection', 'Invoke-ExoCommand', 'Get-ExoToken')
FunctionsToExport = @('New-ExoConnection', 'Get-ExoDefaultClientId', 'Invoke-ExoCommand', 'Get-ExoToken')

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
Expand Down
37 changes: 32 additions & 5 deletions Module/ExoHelper/ExoHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,33 @@ function New-ExoConnection
None
.EXAMPLE
New-ExoConnection -authenticationfactory $factory -TenantId mydomain.onmicrosoft.com
New-AadAuthenticationFactory -ClientId (Get-ExoDefaultClientId) -TenantId 'mydomain.onmicrosoft.com' -AuthMode Interactive
New-ExoConnection -authenticationfactory $factory
Description
-----------
This command initializes connection to EXO REST API.
It uses instance of AADAuthenticationFactory for authentication with EXO REST API
.EXAMPLE
New-AadAuthenticationFactory -ClientId (Get-ExoDefaultClientId) -TenantId 'mydomain.onmicrosoft.com' -AuthMode Interactive | New-ExoConnection -IPPS
Description
-----------
This command initializes connection to IPPS REST API.
It uses instance of AADAuthenticationFactory for authentication with IPPS REST API passed via pipeline
#>
param
(
[Parameter(Mandatory)]
[Parameter(Mandatory, ValueFromPipeline)]
#AAD authentication factory created via New-AadAuthenticationFactory
#for user context, user factory created with clientId = fb78d390-0c51-40cd-8e17-fdbfab77341b (clientId of ExchangeOnlineManagement module) or your app with appropriate scopes assigned
$AuthenticationFactory,

[Parameter(Mandatory)]
#Tenant ID - tenant native domain (xxx.onmicrosoft.com)
[Parameter()]
#Tenant ID when not the same as specified for factory - tenant native domain (xxx.onmicrosoft.com, or tenant GUID)
[string]
$TenantId,

Expand All @@ -37,7 +48,8 @@ param
$AnchorMailbox,

[switch]
#Connection specialized to call IPPS commands
#Connection is specialized to call IPPS commands
#If not present, connection is specialized to call Exchange Online commands
$IPPS
)

Expand Down Expand Up @@ -85,6 +97,20 @@ param
}
}

function Get-ExoDefaultClientId
{
[CmdletBinding()]
param
(
[Parameter()]
[switch]
$IPPS
)
process
{
'fb78d390-0c51-40cd-8e17-fdbfab77341b'
}
}

function Get-ExoToken
{
Expand Down Expand Up @@ -211,6 +237,7 @@ This command retrieves mailbox of user JohnDoe and returns just netId property
$headers['Prefer'] = "odata.maxpagesize=$batchSize"
$headers['connection-id'] = $Connection.connectionId
$headers['X-AnchorMailbox'] =$Connection.anchorMailbox
$headers['X-ClientApplication'] ='ExoHelper'

#make sure that hashTable in parameters is properly decorated
foreach($key in $Parameters.Keys)
Expand Down

0 comments on commit 0ca0ba5

Please sign in to comment.