Skip to content

Commit

Permalink
Merge pull request #1134 from JohnDuprey/dev
Browse files Browse the repository at this point in the history
AsApp support
  • Loading branch information
JohnDuprey authored Oct 3, 2024
2 parents 2e95af5 + 5958925 commit ea2920f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function Push-ListGraphRequestQueue {
NoPagination = $Item.NoPagination
ReverseTenantLookupProperty = $Item.ReverseTenantLookupProperty
ReverseTenantLookup = $Item.ReverseTenantLookup
AsApp = $Item.AsApp ?? $false
SkipCache = $true
}

Expand Down
11 changes: 9 additions & 2 deletions Modules/CIPPCore/Public/GraphRequests/Get-GraphRequestList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ function Get-GraphRequestList {
[switch]$CountOnly,
[switch]$NoAuthCheck,
[switch]$ReverseTenantLookup,
[string]$ReverseTenantLookupProperty = 'tenantId'
[string]$ReverseTenantLookupProperty = 'tenantId',
[boolean]$AsApp = $false
)

$SingleTenantThreshold = 8000
Expand Down Expand Up @@ -110,6 +111,9 @@ function Get-GraphRequestList {
if ($NoAuthCheck.IsPresent) {
$GraphRequest.noauthcheck = $NoAuthCheck.IsPresent
}
if ($AsApp) {
$GraphRequest.asApp = $AsApp
}
if ($Parameters.'$count' -and !$SkipCache.IsPresent -and !$NoPagination.IsPresent) {
$Count = New-GraphGetRequest @GraphRequest -CountOnly -ErrorAction Stop
if ($CountOnly.IsPresent) { return $Count }
Expand Down Expand Up @@ -174,6 +178,8 @@ function Get-GraphRequestList {
NoPagination = $using:NoPagination.IsPresent
ReverseTenantLookupProperty = $using:ReverseTenantLookupProperty
ReverseTenantLookup = $using:ReverseTenantLookup.IsPresent
NoAuthCheck = $using:NoAuthCheck.IsPresent
AsApp = $using:AsApp
SkipCache = $true
}

Expand Down Expand Up @@ -220,6 +226,7 @@ function Get-GraphRequestList {
PartitionKey = $PartitionKey
NoPagination = $NoPagination.IsPresent
NoAuthCheck = $NoAuthCheck.IsPresent
AsApp = $AsApp
ReverseTenantLookupProperty = $ReverseTenantLookupProperty
ReverseTenantLookup = $ReverseTenantLookup.IsPresent
}
Expand Down Expand Up @@ -289,7 +296,7 @@ function Get-GraphRequestList {

$GraphRequestResults = New-GraphGetRequest @GraphRequest -Caller 'Get-GraphRequestList' -ErrorAction Stop
if ($GraphRequestResults.nextLink) {
$Metadata['nextLink'] = $GraphRequestResults.nextLink | Select-Object -Last 1
#$Metadata['nextLink'] = $GraphRequestResults.nextLink | Select-Object -Last 1
#GraphRequestResults is an array of objects, so we need to remove the last object before returning
$GraphRequestResults = $GraphRequestResults | Select-Object -First ($GraphRequestResults.Count - 1)
}
Expand Down

0 comments on commit ea2920f

Please sign in to comment.