Skip to content

Commit

Permalink
🧹 fetch all ms365 applications (add pagination when fetching resource…
Browse files Browse the repository at this point in the history
…s) (#5035)
  • Loading branch information
vjeffrey authored Dec 24, 2024
1 parent eab3ae0 commit 41c6ef2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions providers/ms365/resources/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (a *mqlMicrosoft) applications() ([]interface{}, error) {
return nil, err
}
ctx := context.Background()
top := int32(999)
top := int32(500)
resp, err := graphClient.Applications().Get(ctx, &applications.ApplicationsRequestBuilderGetRequestConfiguration{
QueryParameters: &applications.ApplicationsRequestBuilderGetQueryParameters{
Top: &top,
Expand All @@ -40,9 +40,13 @@ func (a *mqlMicrosoft) applications() ([]interface{}, error) {
return nil, transformError(err)
}

allApps, err := iterate[*models.Application](ctx, resp, graphClient.GetAdapter(), applications.CreateDeltaGetResponseFromDiscriminatorValue)
if err != nil {
return nil, transformError(err)
}

res := []interface{}{}
apps := resp.GetValue()
for _, app := range apps {
for _, app := range allApps {
mqlResource, err := newMqlMicrosoftApplication(a.MqlRuntime, app)
if err != nil {
return nil, err
Expand Down

0 comments on commit 41c6ef2

Please sign in to comment.